--- - name: Manage Rancher Workers hosts: rancher-worker become: true vars: token: !vault | $ANSIBLE_VAULT;1.1;AES256 30613833333861303239396233323731343562623565303962393536393462306336643534383235 6637613737633931653532613463353838366261303765320a616464653364613737396265313739 62363131353535386434616431343432393439636662363130616363616334656534326134623932 6466613036363633360a343033373765646334643639383530343834656661643265363463303434 37653032383161396265633433356433623463386165386538626366366665333361363939613364 33343964623037356162643661666165666562366535656638663537653034626161636239306332 316239663536613064353830333936326465 ca: !vault | $ANSIBLE_VAULT;1.1;AES256 66303462636433643737393864633234346333386139653762383330333661373337626462393063 6433333266303337343937346231303661323039373135620a316263303734393537393232623932 66396534613032666430613139636533616130353131653263646532326537343066383662366261 3262306262393932390a646132323834363033363934376639396466396661346530323539326236 61313263626134653963653433653234353061626135373738366361343134323331323737623632 63386463306437306661363734666561366166326330646434626338323065373731616137616564 62613563306666376664333564316435313431643336386466303164663363383032343431356263 31623761653032636235 tasks: - include_role: name: common vars: #linux: true #docker: true - name: stop agent if found docker_container: name: rancherworker state: stopped ignore_errors: true - name: start agent docker_container: name: rancherworker image: rancher/rancher-agent:v2.3.2 state: started network_mode: host privileged: true restart_policy: unless-stopped command: --worker --etcd --controlplane env: server=https://192.168.0.241 #token=krgdcfchvhprzstmwgbsmzz2qj8kmcrgc8q26wpdklr9kfpdqgg5sg "token={{ token }}" #ca-checksum=a7077c8e0381f72a7091eda6e617a16b2259227113f66d042a453767174b2dbb volumes: - "/etc/kubernetes:/etc/kubernetes" - "/var/run:/var/run" # --worker