Browse Source

pass connection as vars as requested since ansible 2.2

python3
Andrea Cimbalo 8 years ago
parent
commit
352a22f500
13 changed files with 30 additions and 30 deletions
  1. +1
    -1
      blogs.yaml
  2. +1
    -1
      ldap.yaml
  3. +1
    -1
      lists.yaml
  4. +1
    -1
      logger.yaml
  5. +1
    -1
      mail.yaml
  6. +1
    -1
      projects.yaml
  7. +1
    -1
      requirements.txt
  8. +14
    -19
      roles/ssh_server/tasks/main.yaml
  9. +5
    -0
      tasks/ca-dialog.yaml
  10. +1
    -1
      team_server.yaml
  11. +1
    -1
      users.yaml
  12. +1
    -1
      webmail.yaml
  13. +1
    -1
      wiki.yaml

+ 1
- 1
blogs.yaml View File

@ -4,7 +4,7 @@
- role: lxc_guest
vm_name: blogs
- role: ssh_server
connection: lxc_ssh
ansible_connection: lxc_ssh
ansible_docker_extra_args: blogs
- hosts: blogs
roles:


+ 1
- 1
ldap.yaml View File

@ -4,7 +4,7 @@
- role: lxc_guest
vm_name: ldap
- role: ssh_server
connection: lxc_ssh
ansible_connection: lxc_ssh
ansible_docker_extra_args: ldap
- hosts: ldap
roles:


+ 1
- 1
lists.yaml View File

@ -4,7 +4,7 @@
- role: lxc_guest
vm_name: lists
- role: ssh_server
connection: lxc_ssh
ansible_connection: lxc_ssh
ansible_docker_extra_args: lists
- hosts: lists
roles:


+ 1
- 1
logger.yaml View File

@ -4,7 +4,7 @@
- role: lxc_guest
vm_name: logger
- role: ssh_server
connection: lxc_ssh
ansible_connection: lxc_ssh
ansible_docker_extra_args: logger
- hosts: all


+ 1
- 1
mail.yaml View File

@ -4,7 +4,7 @@
- role: lxc_guest
vm_name: mail
- role: ssh_server
connection: lxc_ssh
ansible_connection: lxc_ssh
ansible_docker_extra_args: mail
- hosts: mail
roles:


+ 1
- 1
projects.yaml View File

@ -5,7 +5,7 @@
vm_name: projects
# distro: sid
- role: ssh_server
connection: lxc_ssh
ansible_connection: lxc_ssh
ansible_docker_extra_args: projects
- hosts: projects
roles:


+ 1
- 1
requirements.txt View File

@ -1,4 +1,4 @@
ansible==2.2.1.0
ansible==2.2.0.0
appdirs==1.4.3
asn1crypto==0.22.0
cffi==1.10.0


+ 14
- 19
roles/ssh_server/tasks/main.yaml View File

@ -26,7 +26,7 @@
- name: generate host request
set_fact:
cert_request:
ca_request:
type: 'sign_request'
request:
keyType: 'ssh_host'
@ -34,16 +34,13 @@
keyData: "{{ vm_public_key['content'] | b64decode | replace('\n', '')}}"
- debug:
var: cert_request | to_json
var: ca_request | to_json
verbosity: 2
- name: start sign request
raw: "{{ cert_request | to_json }}"
delegate_to: ca_request
delegate_facts: True
connection: ssh
register: request_result
failed_when: "( request_result.stdout | from_json ).failed"
include: ca-dialog.yaml
vars:
ansible_connection: ssh
- debug:
var: request_result
@ -58,31 +55,29 @@
- name: generate get request
set_fact:
get_request:
ca_request:
type: 'get_certificate'
requestID: '{{ request_output.requestID }}'
- debug:
var: get_request
var: ca_request
verbosity: 2
- debug:
msg: "Please manualy confirm sign request with id {{ request_output.requestID }}"
- name: wait for cert
raw: "{{ get_request | to_json }}"
delegate_to: ca_request
delegate_facts: True
connection: ssh
register: cert_result
failed_when: "(cert_result.stdout | from_json).failed"
include: ca-dialog.yaml
vars:
ansible_connection: ssh
request: get_request
- debug:
var: cert_result
var: request_result
verbosity: 2
- set_fact:
cert_key: "{{ cert_result.stdout | string | from_json }}"
cert_key: "{{ request_result.stdout | string | from_json }}"
- name: Write certificate to container
copy:
@ -118,7 +113,7 @@
- meta: flush_handlers
- name: "waiting for ssh on {{ inventory_hostname }} vm to start"
- name: "waiting for ssh on {{ ansible_docker_extra_args | default(inventory_hostname) }} to start"
wait_for:
host: "{{ hostvars[inventory_hostname]['ansible_host'] }}"
port: 22


+ 5
- 0
tasks/ca-dialog.yaml View File

@ -0,0 +1,5 @@
- raw: "{{ ca_request | to_json }}"
delegate_to: ca_request
delegate_facts: True
register: request_result
failed_when: "( request_result.stdout | from_json ).failed"

+ 1
- 1
team_server.yaml View File

@ -4,7 +4,7 @@
- role: lxc_guest
vm_name: team
- role: ssh_server
connection: lxc_ssh
ansible_connection: lxc_ssh
ansible_docker_extra_args: team
- hosts: team
roles:


+ 1
- 1
users.yaml View File

@ -4,7 +4,7 @@
- role: lxc_guest
vm_name: users
- role: ssh_server
connection: lxc_ssh
ansible_connection: lxc_ssh
ansible_docker_extra_args: users
- hosts: users
roles:


+ 1
- 1
webmail.yaml View File

@ -4,7 +4,7 @@
- role: lxc_guest
vm_name: webmail
- role: ssh_server
connection: lxc_ssh
ansible_connection: lxc_ssh
ansible_docker_extra_args: webmail
- hosts: webmail
roles:


+ 1
- 1
wiki.yaml View File

@ -4,7 +4,7 @@
- role: lxc_guest
vm_name: wiki
- role: ssh_server
connection: lxc_ssh
ansible_connection: lxc_ssh
ansible_docker_extra_args: wiki
- hosts: wiki
roles:


Loading…
Cancel
Save