diff --git a/roles/lxc_swarm/tasks/lxc_nodes.yml b/roles/lxc_swarm/tasks/lxc_nodes.yml index a1ad096..7066bb5 100644 --- a/roles/lxc_swarm/tasks/lxc_nodes.yml +++ b/roles/lxc_swarm/tasks/lxc_nodes.yml @@ -1,4 +1,5 @@ --- + - name: Create debian containers for swarm lxc_container: name: "{{ item }}" @@ -42,3 +43,4 @@ - name: Install python on LXC container raw: which python || (apt-get -y update && apt-get install -y python) when: inventory_hostname in groups['workers'] + tags: python diff --git a/roles/lxc_swarm/tasks/main.yml b/roles/lxc_swarm/tasks/main.yml index dc9cdfe..20eb6bb 100644 --- a/roles/lxc_swarm/tasks/main.yml +++ b/roles/lxc_swarm/tasks/main.yml @@ -1,17 +1,5 @@ --- # tasks file for roles/galera_swarm -- name: Load in local SSH key path - set_fact: - my_ssh_key: "/root/.ssh/id_rsa.pub" - when: inventory_hostname in groups['manager'] - tags: lxc - -- name: Local user has an SSH key - command: stat {{ my_ssh_key }} - changed_when: false - run_once: true - when: inventory_hostname in groups['manager'] - - include: prepare_host.yml when: inventory_hostname in groups['manager'] @@ -19,7 +7,6 @@ when: inventory_hostname in groups['manager'] - include: lxc_nodes.yml - when: inventory_hostname in groups['manager'] - include: prepare_host.yml when: inventory_hostname in groups['workers'] diff --git a/roles/lxc_swarm/tasks/prepare_host.yml b/roles/lxc_swarm/tasks/prepare_host.yml index bcb822c..8addc94 100644 --- a/roles/lxc_swarm/tasks/prepare_host.yml +++ b/roles/lxc_swarm/tasks/prepare_host.yml @@ -1,4 +1,15 @@ --- +- name: Load in local SSH key path + set_fact: + my_ssh_key: "/root/.ssh/id_rsa.pub" + when: inventory_hostname in groups['manager'] + +- name: Local user has an SSH key + command: stat {{ my_ssh_key }} + changed_when: false + run_once: true + when: inventory_hostname in groups['manager'] + - name: Install python-apt to use ansible apt module shell: apt update && apt install -y python-apt