cs171027 4 years ago
parent
commit
52817292e7
  1. 2
      roles/lxc_swarm/tasks/lxc_nodes.yml
  2. 13
      roles/lxc_swarm/tasks/main.yml
  3. 11
      roles/lxc_swarm/tasks/prepare_host.yml

2
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

13
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']

11
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

Loading…
Cancel
Save