Initial collection structure
Migrated from legacy playbook repo into Ansible collection format: Roles (171 total): - common: 44 roles (fact gathering, SSH setup, utilities) - configuration: 32 roles (system config, networking, satellite) - provisioning: 16 roles (VMware, Azure, physical server deployment) - security: 15 roles (OpenSCAP hardening, certificates, AD integration) - monitoring: 12 roles (Zabbix, logging agents, metrics) - networking: 12 roles (DNS, DHCP, network interfaces) - satellite: 4 roles (Pulp/Satellite management) - misc: 36 roles (various utilities) Playbooks (159 total): - provisioning: 14 playbooks - azure: 13 playbooks - configuration: 22 playbooks - maintenance: 10 playbooks - security: 10 playbooks - monitoring: 9 playbooks - vcenter: 6 playbooks - networking: 7 playbooks - misc: 65 playbooks
This commit is contained in:
38
roles/networking/azure-compare-ip/README.md
Normal file
38
roles/networking/azure-compare-ip/README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
Created by the UFST Linux team
|
||||
2
roles/networking/azure-compare-ip/defaults/main.yml
Normal file
2
roles/networking/azure-compare-ip/defaults/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# defaults file for azure-compare-ip
|
||||
2
roles/networking/azure-compare-ip/handlers/main.yml
Normal file
2
roles/networking/azure-compare-ip/handlers/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# handlers file for azure-compare-ip
|
||||
57
roles/networking/azure-compare-ip/meta/main.yml
Normal file
57
roles/networking/azure-compare-ip/meta/main.yml
Normal file
@@ -0,0 +1,57 @@
|
||||
galaxy_info:
|
||||
author: your name
|
||||
description: your description
|
||||
company: your company (optional)
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Some suggested licenses:
|
||||
# - BSD (default)
|
||||
# - MIT
|
||||
# - GPLv2
|
||||
# - GPLv3
|
||||
# - Apache
|
||||
# - CC-BY
|
||||
license: license (GPLv2, CC-BY, etc)
|
||||
|
||||
min_ansible_version: 1.2
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
||||
# repo for this role. During role install, if no tags are available,
|
||||
# Galaxy will use this branch. During import Galaxy will access files on
|
||||
# this branch. If Travis integration is configured, only notifications for this
|
||||
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||
# (usually master) will be used.
|
||||
#github_branch:
|
||||
|
||||
#
|
||||
# platforms is a list of platforms, and each platform has a name and a list of versions.
|
||||
#
|
||||
# platforms:
|
||||
# - name: Fedora
|
||||
# versions:
|
||||
# - all
|
||||
# - 25
|
||||
# - name: SomePlatform
|
||||
# versions:
|
||||
# - all
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
7
roles/networking/azure-compare-ip/tasks/main.yml
Normal file
7
roles/networking/azure-compare-ip/tasks/main.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
# Verification task for azure provision playbooks validating the azure provided IP against the resolved ip
|
||||
- name: DNS resolves to Azure provided IP
|
||||
assert:
|
||||
that:
|
||||
- "'{{ resolved_ip }}' == '{{ vm_ip | default(ip) }}'"
|
||||
msg: "DNS name does not resolve to {{ vm_ip | default(ip) }}"
|
||||
2
roles/networking/azure-compare-ip/tests/inventory
Normal file
2
roles/networking/azure-compare-ip/tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
||||
localhost
|
||||
|
||||
5
roles/networking/azure-compare-ip/tests/test.yml
Normal file
5
roles/networking/azure-compare-ip/tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- azure-compare-ip
|
||||
2
roles/networking/azure-compare-ip/vars/main.yml
Normal file
2
roles/networking/azure-compare-ip/vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# vars file for azure-compare-ip
|
||||
38
roles/networking/azure-get-ip/README.md
Normal file
38
roles/networking/azure-get-ip/README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
Created by the UFST Linux team
|
||||
2
roles/networking/azure-get-ip/defaults/main.yml
Normal file
2
roles/networking/azure-get-ip/defaults/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# defaults file for azure-get-ip
|
||||
2
roles/networking/azure-get-ip/handlers/main.yml
Normal file
2
roles/networking/azure-get-ip/handlers/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# handlers file for azure-get-ip
|
||||
57
roles/networking/azure-get-ip/meta/main.yml
Normal file
57
roles/networking/azure-get-ip/meta/main.yml
Normal file
@@ -0,0 +1,57 @@
|
||||
galaxy_info:
|
||||
author: your name
|
||||
description: your description
|
||||
company: your company (optional)
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Some suggested licenses:
|
||||
# - BSD (default)
|
||||
# - MIT
|
||||
# - GPLv2
|
||||
# - GPLv3
|
||||
# - Apache
|
||||
# - CC-BY
|
||||
license: license (GPLv2, CC-BY, etc)
|
||||
|
||||
min_ansible_version: 1.2
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
||||
# repo for this role. During role install, if no tags are available,
|
||||
# Galaxy will use this branch. During import Galaxy will access files on
|
||||
# this branch. If Travis integration is configured, only notifications for this
|
||||
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||
# (usually master) will be used.
|
||||
#github_branch:
|
||||
|
||||
#
|
||||
# platforms is a list of platforms, and each platform has a name and a list of versions.
|
||||
#
|
||||
# platforms:
|
||||
# - name: Fedora
|
||||
# versions:
|
||||
# - all
|
||||
# - 25
|
||||
# - name: SomePlatform
|
||||
# versions:
|
||||
# - all
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
14
roles/networking/azure-get-ip/tasks/main.yml
Normal file
14
roles/networking/azure-get-ip/tasks/main.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
- name: Get network interface facts
|
||||
azure_rm_networkinterface_facts:
|
||||
resource_group: "{{ tapi_resource_group }}"
|
||||
name: "{{ vm_name | default (inventory_hostname)}}"
|
||||
register: nic_facts
|
||||
|
||||
- name: Set IP address fact
|
||||
set_fact:
|
||||
vm_ip: "{{ nic_facts.ansible_facts.azure_networkinterfaces[0].properties.ipConfigurations[0].properties.privateIPAddress }}"
|
||||
|
||||
- debug:
|
||||
msg: "{{ vm_ip }}"
|
||||
|
||||
2
roles/networking/azure-get-ip/tests/inventory
Normal file
2
roles/networking/azure-get-ip/tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
||||
localhost
|
||||
|
||||
5
roles/networking/azure-get-ip/tests/test.yml
Normal file
5
roles/networking/azure-get-ip/tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- azure-get-ip
|
||||
2
roles/networking/azure-get-ip/vars/main.yml
Normal file
2
roles/networking/azure-get-ip/vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# vars file for azure-get-ip
|
||||
38
roles/networking/change-ip-address/README.md
Executable file
38
roles/networking/change-ip-address/README.md
Executable file
@@ -0,0 +1,38 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
Created by the UFST Linux team
|
||||
2
roles/networking/change-ip-address/defaults/main.yml
Executable file
2
roles/networking/change-ip-address/defaults/main.yml
Executable file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# defaults file for change-ip-address
|
||||
2
roles/networking/change-ip-address/handlers/main.yml
Executable file
2
roles/networking/change-ip-address/handlers/main.yml
Executable file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# handlers file for change-ip-address
|
||||
57
roles/networking/change-ip-address/meta/main.yml
Executable file
57
roles/networking/change-ip-address/meta/main.yml
Executable file
@@ -0,0 +1,57 @@
|
||||
galaxy_info:
|
||||
author: your name
|
||||
description: your description
|
||||
company: your company (optional)
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Some suggested licenses:
|
||||
# - BSD (default)
|
||||
# - MIT
|
||||
# - GPLv2
|
||||
# - GPLv3
|
||||
# - Apache
|
||||
# - CC-BY
|
||||
license: license (GPLv2, CC-BY, etc)
|
||||
|
||||
min_ansible_version: 1.2
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
||||
# repo for this role. During role install, if no tags are available,
|
||||
# Galaxy will use this branch. During import Galaxy will access files on
|
||||
# this branch. If Travis integration is configured, only notifications for this
|
||||
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||
# (usually master) will be used.
|
||||
#github_branch:
|
||||
|
||||
#
|
||||
# platforms is a list of platforms, and each platform has a name and a list of versions.
|
||||
#
|
||||
# platforms:
|
||||
# - name: Fedora
|
||||
# versions:
|
||||
# - all
|
||||
# - 25
|
||||
# - name: SomePlatform
|
||||
# versions:
|
||||
# - all
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
19
roles/networking/change-ip-address/tasks/main.yml
Executable file
19
roles/networking/change-ip-address/tasks/main.yml
Executable file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
- name: Get the current IP
|
||||
shell: nmcli connection show '{{ interface | default("ens192") }}' | grep "ipv4.addresses:" | awk '{ print substr($2, 0, index($2, "/")-1)}'
|
||||
register: current_ip
|
||||
changed_when: False
|
||||
|
||||
- name: Current IP
|
||||
debug: msg={{ current_ip.stdout }}
|
||||
|
||||
- name: Set the new IP
|
||||
command: nmcli con mod '{{ interface | default("ens192") }}' ipv4.address {{ new_ip }}/{{ new_ip_cidr}}
|
||||
when: "current_ip.stdout != new_ip"
|
||||
|
||||
- name: Restart network
|
||||
systemd:
|
||||
name: network
|
||||
state: restarted
|
||||
no_block: True
|
||||
when: "current_ip.stdout != new_ip"
|
||||
2
roles/networking/change-ip-address/tests/inventory
Executable file
2
roles/networking/change-ip-address/tests/inventory
Executable file
@@ -0,0 +1,2 @@
|
||||
localhost
|
||||
|
||||
5
roles/networking/change-ip-address/tests/test.yml
Executable file
5
roles/networking/change-ip-address/tests/test.yml
Executable file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- change-ip-address
|
||||
2
roles/networking/change-ip-address/vars/main.yml
Executable file
2
roles/networking/change-ip-address/vars/main.yml
Executable file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# vars file for change-ip-address
|
||||
38
roles/networking/check-dns-name/README.md
Executable file
38
roles/networking/check-dns-name/README.md
Executable file
@@ -0,0 +1,38 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
Created by the UFST Linux team
|
||||
2
roles/networking/check-dns-name/defaults/main.yml
Executable file
2
roles/networking/check-dns-name/defaults/main.yml
Executable file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# defaults file for check-dns-name
|
||||
2
roles/networking/check-dns-name/handlers/main.yml
Executable file
2
roles/networking/check-dns-name/handlers/main.yml
Executable file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# handlers file for check-dns-name
|
||||
57
roles/networking/check-dns-name/meta/main.yml
Executable file
57
roles/networking/check-dns-name/meta/main.yml
Executable file
@@ -0,0 +1,57 @@
|
||||
galaxy_info:
|
||||
author: your name
|
||||
description: your description
|
||||
company: your company (optional)
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Some suggested licenses:
|
||||
# - BSD (default)
|
||||
# - MIT
|
||||
# - GPLv2
|
||||
# - GPLv3
|
||||
# - Apache
|
||||
# - CC-BY
|
||||
license: license (GPLv2, CC-BY, etc)
|
||||
|
||||
min_ansible_version: 1.2
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
||||
# repo for this role. During role install, if no tags are available,
|
||||
# Galaxy will use this branch. During import Galaxy will access files on
|
||||
# this branch. If Travis integration is configured, only notifications for this
|
||||
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||
# (usually master) will be used.
|
||||
#github_branch:
|
||||
|
||||
#
|
||||
# platforms is a list of platforms, and each platform has a name and a list of versions.
|
||||
#
|
||||
# platforms:
|
||||
# - name: Fedora
|
||||
# versions:
|
||||
# - all
|
||||
# - 25
|
||||
# - name: SomePlatform
|
||||
# versions:
|
||||
# - all
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
17
roles/networking/check-dns-name/tasks/main.yml
Executable file
17
roles/networking/check-dns-name/tasks/main.yml
Executable file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
- debug: msg={{ hostname | default(inventory_hostname) }}
|
||||
|
||||
- name: Verify that DNS record exists
|
||||
command: "ssh {{ jump_host }} 'dig +short {{ hostname | default(inventory_hostname) }}'"
|
||||
delegate_to: localhost
|
||||
ignore_errors: True
|
||||
register: dns_lookup
|
||||
until: dns_lookup.stdout != ''
|
||||
retries: 15
|
||||
delay: 10
|
||||
|
||||
- name: Set resolved ip fact
|
||||
set_fact:
|
||||
resolved_ip: "{{ dns_lookup.stdout }}"
|
||||
|
||||
- debug: msg="IP resolved to {{ resolved_ip }}"
|
||||
2
roles/networking/check-dns-name/tests/inventory
Executable file
2
roles/networking/check-dns-name/tests/inventory
Executable file
@@ -0,0 +1,2 @@
|
||||
localhost
|
||||
|
||||
5
roles/networking/check-dns-name/tests/test.yml
Executable file
5
roles/networking/check-dns-name/tests/test.yml
Executable file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- check-dns-name
|
||||
2
roles/networking/check-dns-name/vars/main.yml
Executable file
2
roles/networking/check-dns-name/vars/main.yml
Executable file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# vars file for check-dns-name
|
||||
38
roles/networking/clear-host-from-known-hosts/README.md
Normal file
38
roles/networking/clear-host-from-known-hosts/README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
Created by the UFST Linux team
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# defaults file for clear-host-from-known-hosts
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# handlers file for clear-host-from-known-hosts
|
||||
57
roles/networking/clear-host-from-known-hosts/meta/main.yml
Normal file
57
roles/networking/clear-host-from-known-hosts/meta/main.yml
Normal file
@@ -0,0 +1,57 @@
|
||||
galaxy_info:
|
||||
author: your name
|
||||
description: your description
|
||||
company: your company (optional)
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Some suggested licenses:
|
||||
# - BSD (default)
|
||||
# - MIT
|
||||
# - GPLv2
|
||||
# - GPLv3
|
||||
# - Apache
|
||||
# - CC-BY
|
||||
license: license (GPLv2, CC-BY, etc)
|
||||
|
||||
min_ansible_version: 1.2
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
||||
# repo for this role. During role install, if no tags are available,
|
||||
# Galaxy will use this branch. During import Galaxy will access files on
|
||||
# this branch. If Travis integration is configured, only notifications for this
|
||||
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||
# (usually master) will be used.
|
||||
#github_branch:
|
||||
|
||||
#
|
||||
# platforms is a list of platforms, and each platform has a name and a list of versions.
|
||||
#
|
||||
# platforms:
|
||||
# - name: Fedora
|
||||
# versions:
|
||||
# - all
|
||||
# - 25
|
||||
# - name: SomePlatform
|
||||
# versions:
|
||||
# - all
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
13
roles/networking/clear-host-from-known-hosts/tasks/main.yml
Normal file
13
roles/networking/clear-host-from-known-hosts/tasks/main.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
# tasks file for clear-host-from-known-hosts
|
||||
- name: Remove {{ inventory_hostname }} from hosts file
|
||||
lineinfile:
|
||||
path: "{{ ansible_env.HOME }}/.ssh/known_hosts"
|
||||
regexp: "^{{ inventory_hostname }}.*"
|
||||
state: absent
|
||||
|
||||
- name: Remove {{ inventory_hostname.split(".")[0] }}
|
||||
lineinfile:
|
||||
path: "{{ ansible_env.HOME }}/.ssh/known_hosts"
|
||||
regexp: "^{{ inventory_hostname.split('.')[0] }}.*"
|
||||
state: absent
|
||||
@@ -0,0 +1,2 @@
|
||||
localhost
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- clear-host-from-known-hosts
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# vars file for clear-host-from-known-hosts
|
||||
38
roles/networking/create-dhcp-reservation/README.md
Normal file
38
roles/networking/create-dhcp-reservation/README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
Created by the UFST Linux team
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# defaults file for create-dhcp-reservation
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# handlers file for create-dhcp-reservation
|
||||
60
roles/networking/create-dhcp-reservation/meta/main.yml
Normal file
60
roles/networking/create-dhcp-reservation/meta/main.yml
Normal file
@@ -0,0 +1,60 @@
|
||||
galaxy_info:
|
||||
author: your name
|
||||
description: your description
|
||||
company: your company (optional)
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Some suggested licenses:
|
||||
# - BSD (default)
|
||||
# - MIT
|
||||
# - GPLv2
|
||||
# - GPLv3
|
||||
# - Apache
|
||||
# - CC-BY
|
||||
license: license (GPLv2, CC-BY, etc)
|
||||
|
||||
min_ansible_version: 2.4
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
||||
# repo for this role. During role install, if no tags are available,
|
||||
# Galaxy will use this branch. During import Galaxy will access files on
|
||||
# this branch. If Travis integration is configured, only notifications for this
|
||||
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||
# (usually master) will be used.
|
||||
#github_branch:
|
||||
|
||||
#
|
||||
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||
# To view available platforms and versions (or releases), visit:
|
||||
# https://galaxy.ansible.com/api/v1/platforms/
|
||||
#
|
||||
# platforms:
|
||||
# - name: Fedora
|
||||
# versions:
|
||||
# - all
|
||||
# - 25
|
||||
# - name: SomePlatform
|
||||
# versions:
|
||||
# - all
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
67
roles/networking/create-dhcp-reservation/tasks/main.yml
Normal file
67
roles/networking/create-dhcp-reservation/tasks/main.yml
Normal file
@@ -0,0 +1,67 @@
|
||||
---
|
||||
- name: Define z23 jump host
|
||||
ansible.builtin.set_fact:
|
||||
linux_server: "z23ljump.DMZ23.EXAMPLE.COM"
|
||||
when: dc_domain == 'DMZ23.EXAMPLE.COM'
|
||||
|
||||
- name: Define z24 jump host
|
||||
ansible.builtin.set_fact:
|
||||
linux_server: "z24ljump.DMZ.EXAMPLE.COM"
|
||||
when: dc_domain == 'DMZ.EXAMPLE.COM'
|
||||
|
||||
- name: Define ccta jump host
|
||||
ansible.builtin.set_fact:
|
||||
linux_server: "ljump.EXAMPLE-CORP.COM"
|
||||
when: dc_domain == 'EXAMPLE-CORP.COM'
|
||||
|
||||
- name: Define windows server
|
||||
ansible.builtin.set_fact:
|
||||
windows_server: "lwinjump01.EXAMPLE-CORP.COM"
|
||||
|
||||
- name: fetch list of used IP's from windows server
|
||||
ansible.windows.win_shell: |
|
||||
powershell.exe -ExecutionPolicy ByPass -Command 'Get-DhcpServerv4Reservation -ComputerName dhcp03.EXAMPLE-CORP.COM -ScopeId "{{ subnet | regex_replace( '\/.*$', '') }}" | Select-Object -ExpandProperty 'IPAddress' | Select -ExpandProperty IPAddressToString'
|
||||
delegate_to: "{{ windows_server }}"
|
||||
vars:
|
||||
ansible_user: "{{ service_user_ccta }}"
|
||||
ansible_password: "{{ schrodingers_password }}"
|
||||
ansible_connection: ssh
|
||||
ansible_shell_type: powershell
|
||||
register: taken_ip
|
||||
|
||||
- name: set output to just ip list
|
||||
ansible.builtin.set_fact:
|
||||
taken_ip: "{{ taken_ip.stdout_lines }}"
|
||||
|
||||
- name: fetch list of all IP's from local linux server
|
||||
ansible.builtin.shell: cat /etc/hostname && nmap -sL -n {{ subnet }} | awk '/Nmap scan report/{print $NF}' | grep -Ev '\.(0|1|255)$'
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: all_ip
|
||||
delegate_to: "{{ linux_server }}"
|
||||
|
||||
- name: set list of all IPs
|
||||
ansible.builtin.set_fact:
|
||||
all_ip: "{{ all_ip.stdout_lines }}"
|
||||
|
||||
- name: compare checklist with list of all available IPs and register list of available
|
||||
ansible.builtin.set_fact:
|
||||
available_ip: "{{ all_ip | difference(taken_ip) }}"
|
||||
|
||||
- name: return an available IP address
|
||||
ansible.builtin.set_fact:
|
||||
available_ip: "{{ available_ip[:10] | random }}"
|
||||
|
||||
- name: assign IP to MAC address
|
||||
ansible.windows.win_shell: |
|
||||
powershell.exe -ExecutionPolicy ByPass -Command 'Add-DhcpServerv4Reservation -ComputerName dhcp03.EXAMPLE-CORP.COM -ScopeId "{{ subnet | regex_replace('\/.*$', '') }}" -IPAddress "{{ available_ip }}" -ClientId "{{ vm_mac | regex_replace(':', '-' ) }}" -Description "{{ inventory_hostname }}" -Name "{{ inventory_hostname }}"'
|
||||
delegate_to: "{{ windows_server }}"
|
||||
vars:
|
||||
ansible_user: "{{ service_user_ccta }}"
|
||||
ansible_password: "{{ schrodingers_password }}"
|
||||
ansible_connection: ssh
|
||||
ansible_shell_type: powershell
|
||||
|
||||
- name: Assign available_ip to tapi fact
|
||||
ansible.builtin.set_fact:
|
||||
tapi_ip: "{{ available_ip }}"
|
||||
2
roles/networking/create-dhcp-reservation/tests/inventory
Normal file
2
roles/networking/create-dhcp-reservation/tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
||||
localhost
|
||||
|
||||
5
roles/networking/create-dhcp-reservation/tests/test.yml
Normal file
5
roles/networking/create-dhcp-reservation/tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- create-dhcp-reservation
|
||||
2
roles/networking/create-dhcp-reservation/vars/main.yml
Normal file
2
roles/networking/create-dhcp-reservation/vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# vars file for create-dhcp-reservation
|
||||
38
roles/networking/create-dns-record/README.md
Normal file
38
roles/networking/create-dns-record/README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
Created by the UFST Linux team
|
||||
17
roles/networking/create-dns-record/defaults/main.yml
Normal file
17
roles/networking/create-dns-record/defaults/main.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
# defaults file for create-dns-record
|
||||
schrodingers_password: !vault |
|
||||
$ANSIBLE_VAULT;1.2.6;AES256
|
||||
REDACTED_FOR_PUBLIC_SHARING
|
||||
|
||||
service_user_dmz23: !vault |
|
||||
$ANSIBLE_VAULT;1.2.6;AES256
|
||||
REDACTED_FOR_PUBLIC_SHARING
|
||||
|
||||
service_user_dmz24: !vault |
|
||||
$ANSIBLE_VAULT;1.2.6;AES256
|
||||
REDACTED_FOR_PUBLIC_SHARING
|
||||
|
||||
service_user_ccta: !vault |
|
||||
$ANSIBLE_VAULT;1.2.6;AES256
|
||||
REDACTED_FOR_PUBLIC_SHARING
|
||||
2
roles/networking/create-dns-record/handlers/main.yml
Normal file
2
roles/networking/create-dns-record/handlers/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# handlers file for create-dns-record
|
||||
60
roles/networking/create-dns-record/meta/main.yml
Normal file
60
roles/networking/create-dns-record/meta/main.yml
Normal file
@@ -0,0 +1,60 @@
|
||||
galaxy_info:
|
||||
author: your name
|
||||
description: your description
|
||||
company: your company (optional)
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Some suggested licenses:
|
||||
# - BSD (default)
|
||||
# - MIT
|
||||
# - GPLv2
|
||||
# - GPLv3
|
||||
# - Apache
|
||||
# - CC-BY
|
||||
license: license (GPLv2, CC-BY, etc)
|
||||
|
||||
min_ansible_version: 2.4
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
||||
# repo for this role. During role install, if no tags are available,
|
||||
# Galaxy will use this branch. During import Galaxy will access files on
|
||||
# this branch. If Travis integration is configured, only notifications for this
|
||||
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||
# (usually master) will be used.
|
||||
#github_branch:
|
||||
|
||||
#
|
||||
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||
# To view available platforms and versions (or releases), visit:
|
||||
# https://galaxy.ansible.com/api/v1/platforms/
|
||||
#
|
||||
# platforms:
|
||||
# - name: Fedora
|
||||
# versions:
|
||||
# - all
|
||||
# - 25
|
||||
# - name: SomePlatform
|
||||
# versions:
|
||||
# - all
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
41
roles/networking/create-dns-record/tasks/ccta_create_dns.yml
Normal file
41
roles/networking/create-dns-record/tasks/ccta_create_dns.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
---
|
||||
- name: Set jump host and DNS server
|
||||
set_fact:
|
||||
dns_server: "hocdc03.EXAMPLE-CORP.COM"
|
||||
when: dc_domain == 'EXAMPLE-CORP.COM'
|
||||
|
||||
- name: Set hostname fact
|
||||
ansible.builtin.set_fact:
|
||||
server_hostname: '{{ inventory_hostname.split(".")[0] | lower }}'
|
||||
|
||||
- name: Create A record for {{ inventory_hostname }}
|
||||
community.windows.win_dns_record:
|
||||
name: "{{ server_hostname }}"
|
||||
type: "A"
|
||||
values: "{{ tapi_ip }}"
|
||||
state: present
|
||||
zone: "{{ dc_domain }}"
|
||||
computer_name: "{{ dns_server }}"
|
||||
delegate_to: "{{ winjump_host }}"
|
||||
vars:
|
||||
ansible_user: "{{ service_user_dmz24 }}"
|
||||
ansible_password: "{{ schrodingers_password }}"
|
||||
ansible_connection: ssh
|
||||
ansible_shell_type: powershell
|
||||
when: tapi_ip is defined and winjump_host != 'unknown' and dns_server != 'unknown'
|
||||
|
||||
- name: Create PTR record for {{ inventory_hostname }}
|
||||
community.windows.win_dns_record:
|
||||
name: "{{ tapi_ip }}"
|
||||
type: "PTR"
|
||||
values: "{{ server_hostname }}"
|
||||
state: present
|
||||
zone: "{{ dc_domain }}"
|
||||
computer_name: "{{ dns_server }}"
|
||||
delegate_to: "{{ winjump_host }}"
|
||||
vars:
|
||||
ansible_user: "{{ service_user_dmz24 }}"
|
||||
ansible_password: "{{ schrodingers_password }}"
|
||||
ansible_connection: ssh
|
||||
ansible_shell_type: powershell
|
||||
when: tapi_ip is defined and winjump_host != 'unknown' and dns_server != 'unknown'
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
- name: Set jump host and DNS server
|
||||
set_fact:
|
||||
dns_server: "z23addc03.DMZ23.EXAMPLE.COM"
|
||||
when: dc_domain == 'DMZ23.EXAMPLE.COM'
|
||||
|
||||
- name: Set hostname fact
|
||||
ansible.builtin.set_fact:
|
||||
server_hostname: '{{ inventory_hostname.split(".")[0] | lower }}'
|
||||
|
||||
- name: Create A record for {{ inventory_hostname }}
|
||||
community.windows.win_dns_record:
|
||||
name: "{{ server_hostname }}"
|
||||
type: "A"
|
||||
values: "{{ tapi_ip }}"
|
||||
state: present
|
||||
zone: "{{ dc_domain }}"
|
||||
computer_name: "{{ dns_server }}"
|
||||
delegate_to: "{{ winjump_host }}"
|
||||
vars:
|
||||
ansible_user: "{{ service_user_dmz24 }}"
|
||||
ansible_password: "{{ schrodingers_password }}"
|
||||
ansible_connection: ssh
|
||||
ansible_shell_type: powershell
|
||||
when: tapi_ip is defined and winjump_host != 'unknown' and dns_server != 'unknown'
|
||||
|
||||
- name: Create PTR record for {{ inventory_hostname }}
|
||||
community.windows.win_dns_record:
|
||||
name: "{{ tapi_ip }}"
|
||||
type: "PTR"
|
||||
values: "{{ server_hostname }}"
|
||||
state: present
|
||||
zone: "{{ dc_domain }}"
|
||||
computer_name: "{{ dns_server }}"
|
||||
delegate_to: "{{ winjump_host }}"
|
||||
vars:
|
||||
ansible_user: "{{ service_user_dmz24 }}"
|
||||
ansible_password: "{{ schrodingers_password }}"
|
||||
ansible_connection: ssh
|
||||
ansible_shell_type: powershell
|
||||
when: tapi_ip is defined and winjump_host != 'unknown' and dns_server != 'unknown'
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
- name: Set jump host and DNS server
|
||||
set_fact:
|
||||
dns_server: "z24addc03.DMZ.EXAMPLE.COM"
|
||||
when: dc_domain == 'DMZ.EXAMPLE.COM'
|
||||
|
||||
- name: Set hostname fact
|
||||
ansible.builtin.set_fact:
|
||||
server_hostname: '{{ inventory_hostname.split(".")[0] | lower }}'
|
||||
|
||||
- name: Create A record for {{ inventory_hostname }}
|
||||
community.windows.win_dns_record:
|
||||
name: "{{ server_hostname }}"
|
||||
type: "A"
|
||||
values: "{{ tapi_ip }}"
|
||||
state: present
|
||||
zone: "{{ dc_domain }}"
|
||||
computer_name: "{{ dns_server }}"
|
||||
delegate_to: "{{ winjump_host }}"
|
||||
vars:
|
||||
ansible_user: "{{ service_user_dmz24 }}"
|
||||
ansible_password: "{{ schrodingers_password }}"
|
||||
ansible_connection: ssh
|
||||
ansible_shell_type: powershell
|
||||
when: tapi_ip is defined and winjump_host != 'unknown' and dns_server != 'unknown'
|
||||
|
||||
- name: Create PTR record for {{ inventory_hostname }}
|
||||
community.windows.win_dns_record:
|
||||
name: "{{ tapi_ip }}"
|
||||
type: "PTR"
|
||||
values: "{{ server_hostname }}"
|
||||
state: present
|
||||
zone: "{{ dc_domain }}"
|
||||
computer_name: "{{ dns_server }}"
|
||||
delegate_to: "{{ winjump_host }}"
|
||||
vars:
|
||||
ansible_user: "{{ service_user_dmz24 }}"
|
||||
ansible_password: "{{ schrodingers_password }}"
|
||||
ansible_connection: ssh
|
||||
ansible_shell_type: powershell
|
||||
when: tapi_ip is defined and winjump_host != 'unknown' and dns_server != 'unknown'
|
||||
13
roles/networking/create-dns-record/tasks/main.yml
Normal file
13
roles/networking/create-dns-record/tasks/main.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
- ansible.builtin.import_tasks: ccta_create_dns.yml
|
||||
when: dc_domain == 'EXAMPLE-CORP.COM'
|
||||
|
||||
- ansible.builtin.import_tasks: dmz23_create_dns.yml
|
||||
when: dc_domain == 'DMZ23.EXAMPLE.COM'
|
||||
|
||||
- ansible.builtin.import_tasks: dmz24_create_dns.yml
|
||||
when: dc_domain == 'DMZ.EXAMPLE.COM'
|
||||
|
||||
- name: Pause for 4 minutes to give the AD a chance to get the record out.
|
||||
pause:
|
||||
minutes: 2
|
||||
2
roles/networking/create-dns-record/tests/inventory
Normal file
2
roles/networking/create-dns-record/tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
||||
localhost
|
||||
|
||||
5
roles/networking/create-dns-record/tests/test.yml
Normal file
5
roles/networking/create-dns-record/tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- create-dns-record
|
||||
2
roles/networking/create-dns-record/vars/main.yml
Normal file
2
roles/networking/create-dns-record/vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# vars file for create-dns-record
|
||||
29
roles/networking/dmz-dns-fix/.travis.yml
Executable file
29
roles/networking/dmz-dns-fix/.travis.yml
Executable file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
language: python
|
||||
python: "2.7"
|
||||
|
||||
# Use the new container infrastructure
|
||||
sudo: false
|
||||
|
||||
# Install ansible
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- python-pip
|
||||
|
||||
install:
|
||||
# Install ansible
|
||||
- pip install ansible
|
||||
|
||||
# Check ansible version
|
||||
- ansible --version
|
||||
|
||||
# Create ansible.cfg with correct roles_path
|
||||
- printf '[defaults]\nroles_path=../' >ansible.cfg
|
||||
|
||||
script:
|
||||
# Basic role syntax check
|
||||
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
|
||||
|
||||
notifications:
|
||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
||||
38
roles/networking/dmz-dns-fix/README.md
Executable file
38
roles/networking/dmz-dns-fix/README.md
Executable file
@@ -0,0 +1,38 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
Created by the UFST Linux team
|
||||
5
roles/networking/dmz-dns-fix/defaults/main.yml
Executable file
5
roles/networking/dmz-dns-fix/defaults/main.yml
Executable file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
# defaults file for realm-join
|
||||
dc_domain: DMZ.EXAMPLE.COM
|
||||
reinstall_realm_packages: False
|
||||
datacenter: onpremise
|
||||
5
roles/networking/dmz-dns-fix/handlers/main.yml
Executable file
5
roles/networking/dmz-dns-fix/handlers/main.yml
Executable file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
# handlers file for realm-join
|
||||
|
||||
- name: restart sssd
|
||||
service: name=sssd state=restarted
|
||||
57
roles/networking/dmz-dns-fix/meta/main.yml
Executable file
57
roles/networking/dmz-dns-fix/meta/main.yml
Executable file
@@ -0,0 +1,57 @@
|
||||
galaxy_info:
|
||||
author: your name
|
||||
description: your description
|
||||
company: your company (optional)
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Some suggested licenses:
|
||||
# - BSD (default)
|
||||
# - MIT
|
||||
# - GPLv2
|
||||
# - GPLv3
|
||||
# - Apache
|
||||
# - CC-BY
|
||||
license: license (GPLv2, CC-BY, etc)
|
||||
|
||||
min_ansible_version: 1.2
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
||||
# repo for this role. During role install, if no tags are available,
|
||||
# Galaxy will use this branch. During import Galaxy will access files on
|
||||
# this branch. If Travis integration is configured, only notifications for this
|
||||
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||
# (usually master) will be used.
|
||||
#github_branch:
|
||||
|
||||
#
|
||||
# platforms is a list of platforms, and each platform has a name and a list of versions.
|
||||
#
|
||||
# platforms:
|
||||
# - name: Fedora
|
||||
# versions:
|
||||
# - all
|
||||
# - 25
|
||||
# - name: SomePlatform
|
||||
# versions:
|
||||
# - all
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
27
roles/networking/dmz-dns-fix/templates/expect_script.sh
Executable file
27
roles/networking/dmz-dns-fix/templates/expect_script.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/expect -f
|
||||
|
||||
{% set computer_ou = '' %}
|
||||
|
||||
{% if dc_domain == 'EXAMPLE-CORP.COM' %}
|
||||
{% set computer_ou = '--computer-ou=OU=Linux,OU=Servere,DC=ccta,DC=dk' %}
|
||||
{% endif %}
|
||||
|
||||
{% if dc_domain == 'clcta.dk' %}
|
||||
{% set computer_ou = '--computer-ou=OU=Linux,OU=Servere,DC=clcta,DC=dk' %}
|
||||
{% endif %}
|
||||
|
||||
{% if dc_domain == 'DMZ23.EXAMPLE.COM' %}
|
||||
{% set computer_ou = '--computer-ou=OU=Linux,OU=Servere,DC=dmz23,DC=local' %}
|
||||
{% endif %}
|
||||
|
||||
{% if dc_domain == 'DMZ.EXAMPLE.COM' %}
|
||||
{% set computer_ou = '--computer-ou=OU=Linux,OU=Servere,DC=dmz24,DC=local' %}
|
||||
{% endif %}
|
||||
|
||||
spawn realm join {{ "krb5-linux.EXAMPLE-CORP.COM" if dc_domain == "EXAMPLE-CORP.COM" else dc_domain }} {{ computer_ou }} -U {{ ad_join_user }}@{{ dc_domain }} --verbose
|
||||
|
||||
expect "Password for {{ ad_join_user }}@{{ dc_domain}}:" { send -- "{{ ad_join_pass }}\r" }
|
||||
|
||||
expect " * Successfully enrolled machine in realm" { send -- "Success" }
|
||||
|
||||
exit 0
|
||||
27
roles/networking/dmz-dns-fix/templates/krb5.conf
Normal file
27
roles/networking/dmz-dns-fix/templates/krb5.conf
Normal file
@@ -0,0 +1,27 @@
|
||||
# Configuration snippets may be placed in this directory as well
|
||||
includedir /etc/krb5.conf.d/
|
||||
|
||||
includedir /var/lib/sss/pubconf/krb5.include.d/
|
||||
[logging]
|
||||
default = FILE:/var/log/krb5libs.log
|
||||
kdc = FILE:/var/log/krb5kdc.log
|
||||
admin_server = FILE:/var/log/kadmind.log
|
||||
|
||||
[libdefaults]
|
||||
dns_lookup_realm = false
|
||||
ticket_lifetime = 24h
|
||||
renew_lifetime = 7d
|
||||
forwardable = true
|
||||
rdns = false
|
||||
default_ccache_name = KEYRING:persistent:%{uid}
|
||||
|
||||
default_realm = {{ dc_domain | upper }}
|
||||
[realms]
|
||||
{{ dc_domain | upper }} = {
|
||||
{{ 'krb5_server = krb5-linux.EXAMPLE-CORP.COM' if datacenter == "azure" and dc_domain == "EXAMPLE-CORP.COM" else '' }}
|
||||
}
|
||||
|
||||
[domain_realm]
|
||||
{{ dc_domain }} = {{ dc_domain | upper }}
|
||||
.{{ dc_domain }} = {{ dc_domain | upper }}
|
||||
|
||||
26
roles/networking/dmz-dns-fix/templates/sssd.conf
Executable file
26
roles/networking/dmz-dns-fix/templates/sssd.conf
Executable file
@@ -0,0 +1,26 @@
|
||||
|
||||
[sssd]
|
||||
domains = {{ dc_domain }}
|
||||
config_file_version = 2
|
||||
services = nss, pam
|
||||
|
||||
[domain/{{ dc_domain }}]
|
||||
ad_domain = {{ dc_domain }}
|
||||
krb5_realm = {{ dc_domain }}
|
||||
realmd_tags = manages-system joined-with-samba
|
||||
cache_credentials = True
|
||||
id_provider = ad
|
||||
krb5_store_password_if_offline = True
|
||||
default_shell = /bin/bash
|
||||
ldap_id_mapping = True
|
||||
#use_fully_qualified_names = True
|
||||
fallback_homedir = /home/%u@%d
|
||||
access_provider = simple
|
||||
ldap_use_tokengroups = False
|
||||
|
||||
#Setup for Dynamic DNS-updates - to prevent DNS-servers from scavenging...
|
||||
dyndns_update = true
|
||||
dyndns_refresh_interval = 43200
|
||||
dyndns_update_ptr = true
|
||||
dyndns_ttl = 3600
|
||||
ad_gpo_ignore_unreadable = True
|
||||
3
roles/networking/dmz-dns-fix/templates/sudoers
Executable file
3
roles/networking/dmz-dns-fix/templates/sudoers
Executable file
@@ -0,0 +1,3 @@
|
||||
%{{ linux_admin_group }} ALL=(ALL) ALL
|
||||
%{{ ansible_hostname }}_sudoers ALL=(ALL) ALL
|
||||
%infra ALL=(ALL) ALL
|
||||
2
roles/networking/dmz-dns-fix/tests/inventory
Executable file
2
roles/networking/dmz-dns-fix/tests/inventory
Executable file
@@ -0,0 +1,2 @@
|
||||
localhost
|
||||
|
||||
5
roles/networking/dmz-dns-fix/tests/test.yml
Executable file
5
roles/networking/dmz-dns-fix/tests/test.yml
Executable file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- realm-join
|
||||
0
roles/networking/dmz-dns-fix/vars/credentials.yml
Normal file
0
roles/networking/dmz-dns-fix/vars/credentials.yml
Normal file
2
roles/networking/dmz-dns-fix/vars/main.yml
Executable file
2
roles/networking/dmz-dns-fix/vars/main.yml
Executable file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# vars file for realm-join
|
||||
38
roles/networking/remove-dns-record/README.md
Normal file
38
roles/networking/remove-dns-record/README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
Created by the UFST Linux team
|
||||
17
roles/networking/remove-dns-record/defaults/main.yml
Normal file
17
roles/networking/remove-dns-record/defaults/main.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
# defaults file for create-dns-record
|
||||
schrodingers_password: !vault |
|
||||
$ANSIBLE_VAULT;1.2.6;AES256
|
||||
REDACTED_FOR_PUBLIC_SHARING
|
||||
|
||||
service_user_dmz23: !vault |
|
||||
$ANSIBLE_VAULT;1.2.6;AES256
|
||||
REDACTED_FOR_PUBLIC_SHARING
|
||||
|
||||
service_user_dmz24: !vault |
|
||||
$ANSIBLE_VAULT;1.2.6;AES256
|
||||
REDACTED_FOR_PUBLIC_SHARING
|
||||
|
||||
service_user_ccta: !vault |
|
||||
$ANSIBLE_VAULT;1.2.6;AES256
|
||||
REDACTED_FOR_PUBLIC_SHARING
|
||||
2
roles/networking/remove-dns-record/handlers/main.yml
Normal file
2
roles/networking/remove-dns-record/handlers/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# handlers file for create-dns-record
|
||||
60
roles/networking/remove-dns-record/meta/main.yml
Normal file
60
roles/networking/remove-dns-record/meta/main.yml
Normal file
@@ -0,0 +1,60 @@
|
||||
galaxy_info:
|
||||
author: your name
|
||||
description: your description
|
||||
company: your company (optional)
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Some suggested licenses:
|
||||
# - BSD (default)
|
||||
# - MIT
|
||||
# - GPLv2
|
||||
# - GPLv3
|
||||
# - Apache
|
||||
# - CC-BY
|
||||
license: license (GPLv2, CC-BY, etc)
|
||||
|
||||
min_ansible_version: 2.4
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
||||
# repo for this role. During role install, if no tags are available,
|
||||
# Galaxy will use this branch. During import Galaxy will access files on
|
||||
# this branch. If Travis integration is configured, only notifications for this
|
||||
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||
# (usually master) will be used.
|
||||
#github_branch:
|
||||
|
||||
#
|
||||
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||
# To view available platforms and versions (or releases), visit:
|
||||
# https://galaxy.ansible.com/api/v1/platforms/
|
||||
#
|
||||
# platforms:
|
||||
# - name: Fedora
|
||||
# versions:
|
||||
# - all
|
||||
# - 25
|
||||
# - name: SomePlatform
|
||||
# versions:
|
||||
# - all
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
41
roles/networking/remove-dns-record/tasks/ccta_remove_dns.yml
Normal file
41
roles/networking/remove-dns-record/tasks/ccta_remove_dns.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
---
|
||||
- name: Set jump host and DNS server
|
||||
set_fact:
|
||||
dns_server: "hocdc01.EXAMPLE-CORP.COM"
|
||||
when: dc_domain == 'EXAMPLE-CORP.COM'
|
||||
|
||||
- name: Set hostname fact
|
||||
ansible.builtin.set_fact:
|
||||
server_hostname: '{{ inventory_hostname.split(".")[0] | lower }}'
|
||||
|
||||
- name: Removing A record for {{ inventory_hostname }}
|
||||
community.windows.win_dns_record:
|
||||
name: "{{ server_hostname }}"
|
||||
type: "A"
|
||||
values: "{{ tapi_ip }}"
|
||||
state: absent
|
||||
zone: "{{ dc_domain }}"
|
||||
computer_name: "{{ dns_server }}"
|
||||
delegate_to: "{{ winjump_host }}"
|
||||
vars:
|
||||
ansible_user: "{{ service_user_dmz24 }}"
|
||||
ansible_password: "{{ schrodingers_password }}"
|
||||
ansible_connection: ssh
|
||||
ansible_shell_type: powershell
|
||||
when: tapi_ip is defined and winjump_host != 'unknown' and dns_server != 'unknown'
|
||||
|
||||
- name: Removing PTR record for {{ inventory_hostname }}
|
||||
community.windows.win_dns_record:
|
||||
name: "{{ tapi_ip }}"
|
||||
type: "PTR"
|
||||
values: "{{ server_hostname }}"
|
||||
state: absent
|
||||
zone: "{{ dc_domain }}"
|
||||
computer_name: "{{ dns_server }}"
|
||||
delegate_to: "{{ winjump_host }}"
|
||||
vars:
|
||||
ansible_user: "{{ service_user_dmz24 }}"
|
||||
ansible_password: "{{ schrodingers_password }}"
|
||||
ansible_connection: ssh
|
||||
ansible_shell_type: powershell
|
||||
when: tapi_ip is defined and winjump_host != 'unknown' and dns_server != 'unknown'
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
- name: Set jump host and DNS server
|
||||
set_fact:
|
||||
dns_server: "z23addc03.DMZ23.EXAMPLE.COM"
|
||||
when: dc_domain == 'DMZ23.EXAMPLE.COM'
|
||||
|
||||
- name: Set hostname fact
|
||||
ansible.builtin.set_fact:
|
||||
server_hostname: '{{ inventory_hostname.split(".")[0] | lower }}'
|
||||
|
||||
- name: Removing A record for {{ inventory_hostname }}
|
||||
community.windows.win_dns_record:
|
||||
name: "{{ server_hostname }}"
|
||||
type: "A"
|
||||
values: "{{ tapi_ip }}"
|
||||
state: absent
|
||||
zone: "{{ dc_domain }}"
|
||||
computer_name: "{{ dns_server }}"
|
||||
delegate_to: "{{ winjump_host }}"
|
||||
vars:
|
||||
ansible_user: "{{ service_user_dmz24 }}"
|
||||
ansible_password: "{{ schrodingers_password }}"
|
||||
ansible_connection: ssh
|
||||
ansible_shell_type: powershell
|
||||
when: tapi_ip is defined and winjump_host != 'unknown' and dns_server != 'unknown'
|
||||
|
||||
- name: Removing PTR record for {{ inventory_hostname }}
|
||||
community.windows.win_dns_record:
|
||||
name: "{{ tapi_ip }}"
|
||||
type: "PTR"
|
||||
values: "{{ server_hostname }}"
|
||||
state: absent
|
||||
zone: "{{ dc_domain }}"
|
||||
computer_name: "{{ dns_server }}"
|
||||
delegate_to: "{{ winjump_host }}"
|
||||
vars:
|
||||
ansible_user: "{{ service_user_dmz24 }}"
|
||||
ansible_password: "{{ schrodingers_password }}"
|
||||
ansible_connection: ssh
|
||||
ansible_shell_type: powershell
|
||||
when: tapi_ip is defined and winjump_host != 'unknown' and dns_server != 'unknown'
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
- name: Set jump host and DNS server
|
||||
set_fact:
|
||||
dns_server: "z24addc03.DMZ.EXAMPLE.COM"
|
||||
when: dc_domain == 'DMZ.EXAMPLE.COM'
|
||||
|
||||
- name: Set hostname fact
|
||||
ansible.builtin.set_fact:
|
||||
server_hostname: '{{ inventory_hostname.split(".")[0] | lower }}'
|
||||
|
||||
- name: Removing A record for {{ inventory_hostname }}
|
||||
community.windows.win_dns_record:
|
||||
name: "{{ server_hostname }}"
|
||||
type: "A"
|
||||
values: "{{ tapi_ip }}"
|
||||
state: absent
|
||||
zone: "{{ dc_domain }}"
|
||||
computer_name: "{{ dns_server }}"
|
||||
delegate_to: "{{ winjump_host }}"
|
||||
vars:
|
||||
ansible_user: "{{ service_user_dmz24 }}"
|
||||
ansible_password: "{{ schrodingers_password }}"
|
||||
ansible_connection: ssh
|
||||
ansible_shell_type: powershell
|
||||
when: tapi_ip is defined and winjump_host != 'unknown' and dns_server != 'unknown'
|
||||
|
||||
- name: Removing PTR record for {{ inventory_hostname }}
|
||||
community.windows.win_dns_record:
|
||||
name: "{{ tapi_ip }}"
|
||||
type: "PTR"
|
||||
values: "{{ server_hostname }}"
|
||||
state: absent
|
||||
zone: "{{ dc_domain }}"
|
||||
computer_name: "{{ dns_server }}"
|
||||
delegate_to: "{{ winjump_host }}"
|
||||
vars:
|
||||
ansible_user: "{{ service_user_dmz24 }}"
|
||||
ansible_password: "{{ schrodingers_password }}"
|
||||
ansible_connection: ssh
|
||||
ansible_shell_type: powershell
|
||||
when: tapi_ip is defined and winjump_host != 'unknown' and dns_server != 'unknown'
|
||||
10
roles/networking/remove-dns-record/tasks/main.yml
Normal file
10
roles/networking/remove-dns-record/tasks/main.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
- ansible.builtin.import_tasks: ccta_remove_dns.yml
|
||||
when: dc_domain == 'EXAMPLE-CORP.COM'
|
||||
|
||||
- ansible.builtin.import_tasks: dmz23_remove_dns.yml
|
||||
when: dc_domain == 'DMZ23.EXAMPLE.COM'
|
||||
|
||||
- ansible.builtin.import_tasks: dmz24_remove_dns.yml
|
||||
when: dc_domain == 'DMZ.EXAMPLE.COM'
|
||||
|
||||
2
roles/networking/remove-dns-record/tests/inventory
Normal file
2
roles/networking/remove-dns-record/tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
||||
localhost
|
||||
|
||||
5
roles/networking/remove-dns-record/tests/test.yml
Normal file
5
roles/networking/remove-dns-record/tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- create-dns-record
|
||||
2
roles/networking/remove-dns-record/vars/main.yml
Normal file
2
roles/networking/remove-dns-record/vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# vars file for create-dns-record
|
||||
29
roles/networking/vmware-connected-network/.travis.yml
Normal file
29
roles/networking/vmware-connected-network/.travis.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
language: python
|
||||
python: "2.7"
|
||||
|
||||
# Use the new container infrastructure
|
||||
sudo: false
|
||||
|
||||
# Install ansible
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- python-pip
|
||||
|
||||
install:
|
||||
# Install ansible
|
||||
- pip install ansible
|
||||
|
||||
# Check ansible version
|
||||
- ansible --version
|
||||
|
||||
# Create ansible.cfg with correct roles_path
|
||||
- printf '[defaults]\nroles_path=../' >ansible.cfg
|
||||
|
||||
script:
|
||||
# Basic role syntax check
|
||||
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
|
||||
|
||||
notifications:
|
||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
||||
38
roles/networking/vmware-connected-network/README.md
Normal file
38
roles/networking/vmware-connected-network/README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
# defaults file for vmware-provision
|
||||
vcenter_host: vcsa01.EXAMPLE-CORP.COM
|
||||
template: RHEL9Template
|
||||
cpus: 2
|
||||
mem_mb: 4096
|
||||
disk_gb: 60
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# handlers file for vmware_connected_network
|
||||
52
roles/networking/vmware-connected-network/meta/main.yml
Normal file
52
roles/networking/vmware-connected-network/meta/main.yml
Normal file
@@ -0,0 +1,52 @@
|
||||
galaxy_info:
|
||||
author: your name
|
||||
description: your role description
|
||||
company: your company (optional)
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Choose a valid license ID from https://spdx.org - some suggested licenses:
|
||||
# - BSD-3-Clause (default)
|
||||
# - MIT
|
||||
# - GPL-2.0-or-later
|
||||
# - GPL-3.0-only
|
||||
# - Apache-2.0
|
||||
# - CC-BY-4.0
|
||||
license: license (GPL-2.0-or-later, MIT, etc)
|
||||
|
||||
min_ansible_version: 2.1
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
#
|
||||
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||
# To view available platforms and versions (or releases), visit:
|
||||
# https://galaxy.ansible.com/api/v1/platforms/
|
||||
#
|
||||
# platforms:
|
||||
# - name: Fedora
|
||||
# versions:
|
||||
# - all
|
||||
# - 25
|
||||
# - name: SomePlatform
|
||||
# versions:
|
||||
# - all
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
20
roles/networking/vmware-connected-network/tasks/main.yml
Normal file
20
roles/networking/vmware-connected-network/tasks/main.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
- include_vars: credentials.yml
|
||||
|
||||
- name: Set Network connected for VM
|
||||
vmware_guest_network:
|
||||
validate_certs: false
|
||||
hostname: "{{ vcenter_host }}"
|
||||
username: "{{ vmware_user }}"
|
||||
password: "{{ vmware_pass }}"
|
||||
datacenter: "{{ vmware_datacenter }}"
|
||||
name: "{{ vm_name | default (inventory_hostname) }}"
|
||||
network_name: "{{ tapi_aci_network }}"
|
||||
connected: true
|
||||
start_connected: true
|
||||
register: set_vm_network
|
||||
|
||||
- name: Sleep for 10 seconds and continue with play
|
||||
ansible.builtin.wait_for:
|
||||
timeout: 10
|
||||
delegate_to: localhost
|
||||
@@ -0,0 +1,2 @@
|
||||
localhost
|
||||
|
||||
5
roles/networking/vmware-connected-network/tests/test.yml
Normal file
5
roles/networking/vmware-connected-network/tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- vmware_connected_network
|
||||
29
roles/networking/vmware-disconnected-network/.travis.yml
Normal file
29
roles/networking/vmware-disconnected-network/.travis.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
language: python
|
||||
python: "2.7"
|
||||
|
||||
# Use the new container infrastructure
|
||||
sudo: false
|
||||
|
||||
# Install ansible
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- python-pip
|
||||
|
||||
install:
|
||||
# Install ansible
|
||||
- pip install ansible
|
||||
|
||||
# Check ansible version
|
||||
- ansible --version
|
||||
|
||||
# Create ansible.cfg with correct roles_path
|
||||
- printf '[defaults]\nroles_path=../' >ansible.cfg
|
||||
|
||||
script:
|
||||
# Basic role syntax check
|
||||
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
|
||||
|
||||
notifications:
|
||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
||||
38
roles/networking/vmware-disconnected-network/README.md
Normal file
38
roles/networking/vmware-disconnected-network/README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
# defaults file for vmware-provision
|
||||
vcenter_host: vcsa01.EXAMPLE-CORP.COM
|
||||
template: RHEL9Template
|
||||
cpus: 2
|
||||
mem_mb: 4096
|
||||
disk_gb: 60
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# handlers file for vmware_connected_network
|
||||
52
roles/networking/vmware-disconnected-network/meta/main.yml
Normal file
52
roles/networking/vmware-disconnected-network/meta/main.yml
Normal file
@@ -0,0 +1,52 @@
|
||||
galaxy_info:
|
||||
author: your name
|
||||
description: your role description
|
||||
company: your company (optional)
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Choose a valid license ID from https://spdx.org - some suggested licenses:
|
||||
# - BSD-3-Clause (default)
|
||||
# - MIT
|
||||
# - GPL-2.0-or-later
|
||||
# - GPL-3.0-only
|
||||
# - Apache-2.0
|
||||
# - CC-BY-4.0
|
||||
license: license (GPL-2.0-or-later, MIT, etc)
|
||||
|
||||
min_ansible_version: 2.1
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
#
|
||||
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||
# To view available platforms and versions (or releases), visit:
|
||||
# https://galaxy.ansible.com/api/v1/platforms/
|
||||
#
|
||||
# platforms:
|
||||
# - name: Fedora
|
||||
# versions:
|
||||
# - all
|
||||
# - 25
|
||||
# - name: SomePlatform
|
||||
# versions:
|
||||
# - all
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user