Browse Source

Updates

dev
cs171027 5 years ago
parent
commit
0703f57b42
  1. 2
      ansible.cfg
  2. 2
      ansible_provisioning.sh
  3. 4
      inventory/hosts
  4. 9
      roles/lxc_swarm/tasks/lxc_nodes.yml
  5. 2
      roles/lxc_swarm/tasks/main.yml

2
ansible.cfg

@ -1,2 +0,0 @@
[all:vars]
ansible_ssh_common_args='-o StrictHostKeyChecking=no -o userknownhostsfile=/dev/null'

2
ansible_provisioning.sh

@ -1,4 +1,4 @@
#!/bin/bash
[ `id -u` -ne 0 ] && exit 1
test -f ~/.ssh/id_rsa.pub || ssh-keygen -t rsa -b 4096 -N '' -f ~/.ssh/id_rsa
test -f /root/.ssh/id_rsa.pub || ssh-keygen -t rsa -b 4096 -N '' -f /root/.ssh/id_rsa
ansible-playbook -i inventory/hosts --skip-tags swarm --diff -v stack.yml

4
inventory/hosts

@ -2,7 +2,7 @@
127.0.0.1 ansible_connection=local
[workers]
10.0.3.100 ansible_ssh_user=root ansible_ssh_common_args='-o StrictHostKeyChecking=no'
10.0.3.101 ansible_ssh_user=root ansible_ssh_common_args='-o StrictHostKeyChecking=no'
10.0.3.100 ansible_ssh_user=root
10.0.3.101 ansible_ssh_user=root
#For more workers add here the extra configuration
#10.0.3.102 ansible_ssh_user=root

9
roles/lxc_swarm/tasks/lxc_nodes.yml

@ -25,8 +25,15 @@
- "worker2"
tags: lxc
- name: Remove old container identification keys
shell: ssh-keygen -f /root/.ssh/known_hosts -R {{ item }}
with_items:
- "10.0.3.100"
- "10.0.3.101"
when: inventory_hostname in groups['manager']
- name: Ensure container key is up-to-date locally
shell: ssh-keyscan {{ item }} >> ~/.ssh/known_hosts
shell: ssh-keyscan {{ item }} >> /root/.ssh/known_hosts
with_items:
- "10.0.3.100"
- "10.0.3.101"

2
roles/lxc_swarm/tasks/main.yml

@ -2,7 +2,7 @@
# tasks file for roles/galera_swarm
- name: Load in local SSH key path
set_fact:
my_ssh_key: "{{ lookup('env','HOME') }}/.ssh/id_rsa.pub"
my_ssh_key: "/root/.ssh/id_rsa.pub"
when: inventory_hostname in groups['manager']
tags: lxc

Loading…
Cancel
Save