34 lines
943 B
YAML
34 lines
943 B
YAML
---
|
|
- name: Install ~root/.ansible_aliases
|
|
template:
|
|
src: ansible_aliases.j2
|
|
dest: /root/.ansible_aliases
|
|
|
|
- name: Enable ansible aliases in ~/.bash_aliases
|
|
lineinfile:
|
|
path: /root/.bash_aliases
|
|
regexp: 'ansible_aliases'
|
|
line: '. ~/.ansible_aliases'
|
|
create: yes
|
|
owner: root
|
|
group: root
|
|
mode: 0640
|
|
|
|
- name: "Check if an ansible-specific ssh keypair exists"
|
|
stat:
|
|
path: ~/.ssh/id_ansible@{{ software.environment }}
|
|
register: keypair
|
|
tags: [ "ssh" ]
|
|
|
|
- name: "Generate an ansible-specific ssh keypair"
|
|
shell: ssh-keygen -C ansible@{{ software.environment }} -f ~/.ssh/id_ansible@{{ software.environment }} -N ""
|
|
when: not keypair.stat.exists
|
|
tags: [ "ssh" ]
|
|
|
|
- name: "Generate /root/.ssh/install_ansible_authorized_ssh_key"
|
|
template:
|
|
src: templates/install_ansible_authorized_ssh_key.j2
|
|
dest: ~/.ssh/install_ansible_ssh_key
|
|
mode: 0700
|
|
tags: [ "ssh", "ssh_authorized_key" ]
|