Initial commit

This commit is contained in:
2019-06-28 02:28:50 +02:00
commit 21fcd86115
107 changed files with 8346 additions and 0 deletions

1
scripts/first-run.retry Normal file
View File

@ -0,0 +1 @@
o25.oopen.de

11
scripts/first-run.yml Normal file
View File

@ -0,0 +1,11 @@
---
- hosts: o25.oopen.de
tasks:
- name: Ensure aptitude is present
raw: test -e /usr/bin/aptitude || apt-get install aptitude -y
- name: Ensure python2 is present (This is necessary for ansible to work properly)
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)

View File

@ -0,0 +1,11 @@
---
- hosts: all
gather_facts: no
tasks:
- name: Update Root user's Password
user:
name: root
update_password: always
password: "{{ root_user.password }}"
when: root_user is defined and root_user|length > 0

View File

@ -0,0 +1,34 @@
---
- hosts: all
gather_facts: no
vars_prompt:
- name: _user_name
prompt: "Give username here"
private: no
- name: _user_pass
prompt: "Give user password here"
private: yes
encrypt: "sha512_crypt"
confirm: yes
salt_size: 8
tasks:
- name: Check if {{ _user_name }} exists.
shell: egrep "^{{ _user_name }}:" /etc/passwd || echo "user_not_exists"
register: user_exists
changed_when: false
- debug:
msg: User does not exists !
when: user_exists.stdout == 'user_not_exists'
- name: Update User Password
user:
name: "{{ _user_name }}"
update_password: always
password: "{{ _user_pass }}"
when: user_exists.stdout != 'user_not_exists'

View File

@ -0,0 +1,17 @@
---
- hosts: all
gather_facts: no
tasks:
- name: Check if directory /home/back exists
stat:
path: /home/back
register: home_back
- name: Set correct group recursivly for directory /home/back
file:
group: back
path: /home/back
recurse: yes
when: home_back.stat.exists

View File

@ -0,0 +1,17 @@
---
- hosts: all
gather_facts: no
tasks:
- name: Check if directory /home/back exists
stat:
path: /home/sysadm
register: home_sysadm
- name: Set correct group recursivly for directory /home/sysadm
file:
group: sysadm
path: /home/sysadm
recurse: yes
when: home_sysadm.stat.exists

19
scripts/test.yml Normal file
View File

@ -0,0 +1,19 @@
---
- hosts: o25.oopen.de
tasks:
- name: debug print all interface ipv4 data
when: "hostvars[ansible_fqdn]['ansible_'~item]['ipv4'] is defined"
debug:
msg="{{ hostvars[ansible_fqdn]['ansible_'~item]['ipv4'] | pprint }}"
with_items:
- "{{ ansible_interfaces | map('replace', '-','_') | list }}"
- name: define traditional ethernet facts
set_fact:
ansible_eth: "{% set ansible_eth = ansible_eth|default([]) + [hostvars[inventory_hostname]['ansible_' + item]] %}{{ ansible_eth|list }}"
when: hostvars[inventory_hostname]['ansible_' + item]['type'] == 'ether'
with_items:
- "{{ hostvars[inventory_hostname]['ansible_interfaces'] }}"

View File

@ -0,0 +1,7 @@
---
- hosts: all
tasks:
- name: Update debian repositories
shell: /root/bin/admin-stuff/os-upgrade.sh

View File

@ -0,0 +1,7 @@
---
- hosts: all
tasks:
- name: Update git repositories
shell: /root/bin/admin-stuff/update_git_repositories.sh