adding users
This commit is contained in:
parent
79bb7e7986
commit
164f342eaa
5
08-adding-users/ansible.cfg
Normal file
5
08-adding-users/ansible.cfg
Normal file
@ -0,0 +1,5 @@
|
||||
[defaults]
|
||||
inventory = inventory
|
||||
private_key_file = ~/.ssh/hetzner
|
||||
|
||||
|
11
08-adding-users/files/default_site.html
Normal file
11
08-adding-users/files/default_site.html
Normal file
@ -0,0 +1,11 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Website test</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p> Goodevening Caleb </p>
|
||||
|
||||
</body>
|
||||
</html>
|
15
08-adding-users/install_apache.yml
Normal file
15
08-adding-users/install_apache.yml
Normal file
@ -0,0 +1,15 @@
|
||||
---
|
||||
- hosts: all
|
||||
become: true
|
||||
tasks:
|
||||
|
||||
#### Ubuntu/Debian Section ####
|
||||
|
||||
- name: Install apache2 package with php support
|
||||
package:
|
||||
name:
|
||||
- "{{ apache_package }}"
|
||||
- "{{ php_package }}"
|
||||
state: latest
|
||||
update_cache: yes
|
||||
|
7
08-adding-users/inventory
Normal file
7
08-adding-users/inventory
Normal file
@ -0,0 +1,7 @@
|
||||
[web_servers]
|
||||
10.0.0.7
|
||||
10.0.0.8
|
||||
|
||||
[db_servers]
|
||||
10.0.0.5
|
||||
10.0.0.11
|
88
08-adding-users/site.yml
Normal file
88
08-adding-users/site.yml
Normal file
@ -0,0 +1,88 @@
|
||||
---
|
||||
- hosts: all
|
||||
become: true
|
||||
pre_tasks:
|
||||
|
||||
- name: install updates for RHEL distros
|
||||
tags: always
|
||||
package:
|
||||
update_only: yes
|
||||
update_cache: yes
|
||||
when: ansible_os_family == "RedHat"
|
||||
|
||||
- name: install updates for Debian distros
|
||||
tags: always
|
||||
package:
|
||||
upgrade: dist
|
||||
update_cache: yes
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- hosts: all
|
||||
become: true
|
||||
tasks:
|
||||
|
||||
- name: Install common packages
|
||||
package:
|
||||
name:
|
||||
- htop
|
||||
- neofetch
|
||||
|
||||
|
||||
|
||||
- hosts: web_servers
|
||||
become: true
|
||||
tags: debian
|
||||
tasks:
|
||||
|
||||
- name: Install apache on web servers
|
||||
tags: apache
|
||||
package:
|
||||
name:
|
||||
- apache2
|
||||
- libapache2-mod-php
|
||||
|
||||
- name: Copy html file
|
||||
tags: website
|
||||
copy:
|
||||
src: default_site.html
|
||||
dest: /var/www/html/index.html
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
|
||||
- name: Add lfultz account
|
||||
tags: debian
|
||||
user:
|
||||
name: lfultz
|
||||
comment: Logan Fultz
|
||||
uid: 1040
|
||||
gid: 1040
|
||||
group: sudo
|
||||
shell: /bin/bash
|
||||
generate_ssh_key: yes
|
||||
ssh_key_bits: 2048
|
||||
ssh_key_file: .ssh/id_rsa
|
||||
|
||||
|
||||
- hosts: db_servers
|
||||
tags: db, el
|
||||
become: true
|
||||
tasks:
|
||||
|
||||
- name: install mariadb package on db servers
|
||||
package:
|
||||
name: mariadb
|
||||
state: latest
|
||||
|
||||
- name: Add lfultz account
|
||||
tags: el
|
||||
user:
|
||||
name: lfultz
|
||||
comment: Logan Fultz
|
||||
uid: 1040
|
||||
gid: 1040
|
||||
group: wheel
|
||||
shell: /bin/bash
|
||||
generate_ssh_key: yes
|
||||
ssh_key_bits: 2048
|
||||
ssh_key_file: .ssh/id_rsa
|
Loading…
Reference in New Issue
Block a user