-
Notifications
You must be signed in to change notification settings - Fork 712
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ansible][docker.py]Replace docker shell with connection plugin (#1269)
* Remove docker.py * Replace docker shell with connection plugin * Add docker host as known * Added missed delegate_to * Fix typo * Fix review comments * Fix review comment
- Loading branch information
1 parent
e2f8b45
commit 3e3a14c
Showing
18 changed files
with
146 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
- include_tasks: add_container_to_inventory.yml | ||
vars: | ||
container_name: teamd | ||
|
||
- block: | ||
- name: Ensure /etc/teamd folder exists | ||
become: true | ||
file: path=/etc/teamd | ||
state=directory | ||
- name: Ensure /etc/teamd folder exists | ||
become: true | ||
file: path=/etc/teamd | ||
state=directory | ||
|
||
- debug: msg={{ item }} | ||
- debug: msg={{ item }} | ||
|
||
- name: Copy teamd configuration file | ||
become: true | ||
template: src=teamd.j2 | ||
dest=/etc/teamd/{{ item['name'] }}.conf | ||
owner=root | ||
group=root | ||
mode=644 | ||
- name: Copy teamd configuration file | ||
become: true | ||
template: src=teamd.j2 | ||
dest=/etc/teamd/{{ item['name'] }}.conf | ||
owner=root | ||
group=root | ||
mode=644 | ||
|
||
vars: | ||
ansible_shell_type: docker | ||
ansible_python_interpreter: docker exec -i teamd python | ||
delegate_to: "{{ ansible_host }}_teamd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
- name: Add/update the public key in the "{{ lookup('env','HOME') + '/.ssh/known_hosts' }}" | ||
delegate_to: localhost | ||
known_hosts: | ||
name: "{{ ansible_host }}" | ||
key: "{{ lookup('pipe', 'ssh-keyscan ' + ansible_host) }}" | ||
state: "present" | ||
|
||
- name: Generate an OpenSSH keypair | ||
delegate_to: localhost | ||
openssh_keypair: | ||
path: "{{ lookup('env','HOME') + '/.ssh/id_rsa' }}" | ||
register: out | ||
|
||
- name: Set authorized key | ||
authorized_key: | ||
user: "{{ ansible_ssh_user }}" | ||
state: present | ||
key: "{{ out.public_key }}" | ||
|
||
- name: Add {{ container_name }} container to inventory | ||
add_host: | ||
name: "{{ ansible_host }}_{{ container_name }}" | ||
ansible_connection: docker | ||
ansible_host: "{{ container_name }}" | ||
ansible_docker_extra_args: "-H=ssh://{{ ansible_ssh_user }}@{{ ansible_host }}" | ||
ansible_user: root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.