Add ssh_manager to expose control of tasks
There might be a time were we only want run the pre task, so rather then copying the code into another modules, just allow the user to override the task list that runs. Change-Id: Id53c87351e691e9f7cc726fec7470eb257c66890 Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
f76f8e10bf
commit
5f3c220551
@ -12,6 +12,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
---
|
||||
# tasks/main.yaml
|
||||
ssh_task_manager:
|
||||
- install
|
||||
- config
|
||||
|
||||
ssh_user_name:
|
||||
ssh_user_home: "/home/{{ ssh_user_name }}"
|
||||
ssh_user_group: "{{ ssh_user_name }}"
|
||||
|
@ -13,6 +13,7 @@
|
||||
# under the License.
|
||||
---
|
||||
- name: Create ssh directory.
|
||||
become: yes
|
||||
file:
|
||||
dest: "{{ ssh_user_home }}/.ssh"
|
||||
group: "{{ ssh_user_group }}"
|
||||
@ -21,6 +22,7 @@
|
||||
state: directory
|
||||
|
||||
- name: Create ssh known_hosts file.
|
||||
become: yes
|
||||
template:
|
||||
dest: "{{ ssh_known_hosts_dest }}"
|
||||
group: "{{ ssh_user_group }}"
|
||||
@ -30,6 +32,7 @@
|
||||
when: ssh_known_hosts_content
|
||||
|
||||
- name: Create ssh private key.
|
||||
become: yes
|
||||
template:
|
||||
dest: "{{ ssh_key_private_dest }}"
|
||||
group: "{{ ssh_user_group }}"
|
||||
@ -39,6 +42,7 @@
|
||||
when: ssh_key_private_content
|
||||
|
||||
- name: Create ssh public key.
|
||||
become: yes
|
||||
template:
|
||||
dest: "{{ ssh_key_public_dest }}"
|
||||
group: "{{ ssh_user_group }}"
|
||||
|
@ -18,6 +18,7 @@
|
||||
when: ssh_package_name is not defined
|
||||
|
||||
- name: Install ssh from package.
|
||||
become: yes
|
||||
package:
|
||||
name: "{{ ssh_package_name }}"
|
||||
state: installed
|
||||
|
@ -15,8 +15,7 @@
|
||||
- name: Include OS-specific variables.
|
||||
include_vars: "{{ ansible_os_family }}.yaml"
|
||||
|
||||
- include: install.yaml
|
||||
become: yes
|
||||
|
||||
- include: config.yaml
|
||||
become: yes
|
||||
- include: "{{ ssh_task }}.yaml"
|
||||
with_items: "{{ ssh_task_manager }}"
|
||||
loop_control:
|
||||
loop_var: ssh_task
|
||||
|
Loading…
Reference in New Issue
Block a user