syncing new ansible playbook locations
This commit is contained in:
30
playbooks/infrastructure/debug_info.yml
Normal file
30
playbooks/infrastructure/debug_info.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
- name: gather debug info
|
||||
hosts: "{{ HOSTS | default('web') }}"
|
||||
become: true
|
||||
gather_facts: false
|
||||
|
||||
tasks:
|
||||
- name: Gather recent vmstat info
|
||||
command: /bin/vmstat 1 5
|
||||
register: vmstat
|
||||
|
||||
- name: Gather top CPU hogs
|
||||
command: ps -eo user,pid,size,pcpu,cmd --sort=-pcpu
|
||||
register: pscpu
|
||||
|
||||
- name: Gather top memory hogs
|
||||
command: ps -eo user,pid,size,pcpu,cmd --sort=-size
|
||||
register: pssize
|
||||
|
||||
- name: Swap + wait states
|
||||
debug:
|
||||
var: vmstat.stdout_lines
|
||||
|
||||
- name: Top 3 CPU hogs
|
||||
debug:
|
||||
var: pscpu.stdout_lines[:4]
|
||||
|
||||
- name: Top 3 memory hogs
|
||||
debug:
|
||||
var: pssize.stdout_lines[:4]
|
||||
38
playbooks/infrastructure/grant_sudo.yml
Normal file
38
playbooks/infrastructure/grant_sudo.yml
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
- name: grant sudo
|
||||
hosts: "{{ HOSTS | default('web') }}"
|
||||
become: true
|
||||
gather_facts: false
|
||||
vars:
|
||||
sudo_cleanup: true
|
||||
|
||||
tasks:
|
||||
- name: Check if sudo user exists on system
|
||||
getent:
|
||||
database: passwd
|
||||
key: "{{ sudo_user }}"
|
||||
|
||||
- name: create sudo rule
|
||||
copy:
|
||||
dest: "/etc/sudoers.d/{{ sudo_user }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0640
|
||||
content: "{{ sudo_user }} ALL=(ALL) NOPASSWD:ALL"
|
||||
|
||||
- name: install package
|
||||
yum:
|
||||
name: at
|
||||
state: latest
|
||||
|
||||
- name: start service
|
||||
service:
|
||||
name: atd
|
||||
state: started
|
||||
|
||||
- name: time based cleanup
|
||||
at:
|
||||
command: "rm /etc/sudoers.d/{{ sudo_user }}"
|
||||
count: "{{ sudo_count | default('10') }}"
|
||||
units: "{{ sudo_units | default('minutes') }}"
|
||||
when: sudo_cleanup|bool
|
||||
15
playbooks/infrastructure/insights.yml
Normal file
15
playbooks/infrastructure/insights.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
- name: install and configure insights agent on all specified nodes
|
||||
hosts: "{{ HOSTS | default('web') }}"
|
||||
tasks:
|
||||
- include_role:
|
||||
name: RedHatInsights.insights-client
|
||||
vars:
|
||||
redhat_portal_username: "{{ insights_user }}"
|
||||
redhat_portal_password: "{{ insights_password }}"
|
||||
insights_display_name: "{{ inventory_hostname }}"
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- name: print info to terminal window
|
||||
debug:
|
||||
msg: "Red Hat Insights is installed and configured for {{ inventory_hostname }}"
|
||||
21
playbooks/infrastructure/patching.yml
Normal file
21
playbooks/infrastructure/patching.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
- name: apply non-kernel updates
|
||||
hosts: "{{ HOSTS | default('web') }}"
|
||||
become: true
|
||||
gather_facts: false
|
||||
|
||||
tasks:
|
||||
- name: upgrade all packages except kernel
|
||||
yum:
|
||||
name: '*'
|
||||
state: latest
|
||||
exclude: kernel*
|
||||
tags: all
|
||||
|
||||
- name: upgrade all packages security related except kernel
|
||||
yum:
|
||||
name: '*'
|
||||
state: latest
|
||||
security: true
|
||||
exclude: kernel*
|
||||
tags: security
|
||||
23
playbooks/infrastructure/windows_iis.yml
Normal file
23
playbooks/infrastructure/windows_iis.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
- name: install the iis web service
|
||||
hosts: windows
|
||||
|
||||
tasks:
|
||||
- name: install iis
|
||||
win_feature:
|
||||
name: Web-Server
|
||||
state: present
|
||||
|
||||
- name: start iis service
|
||||
win_service:
|
||||
name: W3Svc
|
||||
state: started
|
||||
|
||||
- name: Create website index.html
|
||||
win_copy:
|
||||
content: "{{ iis_test_message }}"
|
||||
dest: C:\Inetpub\wwwroot\index.html
|
||||
|
||||
- name: Show website address
|
||||
debug:
|
||||
msg: http://{{ ansible_host }}
|
||||
Reference in New Issue
Block a user