Skip to content
Snippets Groups Projects
Commit 5d24c9c9 authored by jurgenhaas's avatar jurgenhaas
Browse files

ansible-playbooks/general#85 Linting

parent 3fe101ad
No related branches found
No related tags found
No related merge requests found
tunnel_user_name: 'systunnel'
tunnel_user_name: systunnel
---
# file: roles/commonconnect/tasks/main.yml
- name: "Common Connect Role"
- name: Common Connect Role
set_fact:
role_commonconnect_started: true
tags: 'always'
tags:
- always
- block:
- name: "Create The /etc/hosts File"
- name: Create The /etc/hosts File
template:
src: 'etc_hosts.jinja2'
dest: '/etc/hosts'
owner: 'root'
group: 'root'
mode: '644'
src: etc_hosts.jinja2
dest: /etc/hosts
owner: root
group: root
mode: 644
- name: "Copy SSH Config For Server-To-Server Communication For Admins"
- name: Copy SSH Config For Server-To-Server Communication For Admins
template:
src: 'ssh_config.jinja2'
dest: '/home/{{ item }}/.ssh/config'
src: ssh_config.jinja2
dest: /home/{{ item }}/.ssh/config
owner: '{{ item }}'
group: 'root'
mode: '644'
group: root
mode: 644
with_flattened:
- '{{ admins|default([]) }}'
- '{{ jailusers|default([]) }}'
- {{ admins|default([]) }}
- {{ jailusers|default([]) }}
- block:
- name: "Read available variable cache files"
shell: 'ls ~/.ansible/hostvars'
- name: Read available variable cache files
shell: ls ~/.ansible/hostvars
become: no
register: variable_files
failed_when: false
changed_when: false
ignore_errors: true
tags: 'always'
tags:
- always
- include_tasks: 'more.yml'
- include_tasks: more.yml
with_items: '{{ variable_files.stdout_lines|default([]) }}'
loop_control:
loop_var: inventory_name
when: lookup('pipe','hostname') == inventory_hostname
- name: 'Remember that this role had been run'
- name: Remember that this role had been run
set_fact:
role_commonconnect_completed: true
tags: 'always'
tags:
- always
when: '"commonconnect" not in excluded_roles and role_commonconnect_completed is not defined'
when: not excluded_roles or "commonconnect" not in excluded_roles and role_commonconnect_completed is not defined
---
# file: roles/commonconnect/tasks/more.yml
- name: "Set facts"
- name: Set facts
set_fact:
facts: "{{ lookup('file','~/.ansible/hostvars/{{ inventory_name }}') | from_json }}"
- name: "Add Hosts to Hostfile"
- name: Add Hosts to Hostfile
lineinfile:
dest: '/etc/hosts'
regexp: '.* {{ item }}$'
dest: /etc/hosts
regexp: .* {{ item }}$
line: '{{ facts[item].static_ipv4 }} {{ item }}'
state: 'present'
state: present
with_items: '{{ facts|default([]) }}'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment