first code commit

This commit is contained in:
Bryan Joshua Pedini 2022-03-16 12:59:37 +01:00
parent 285e458cd6
commit 2706dc7d57
6 changed files with 59 additions and 0 deletions

4
ansible.cfg Normal file
View File

@ -0,0 +1,4 @@
[defaults]
nocows = True
inventory = ./inventory.ini
interpreter_python = auto_silent

2
inventory.ini Normal file
View File

@ -0,0 +1,2 @@
[localhost]
127.0.0.1

7
main.yml Normal file
View File

@ -0,0 +1,7 @@
---
- hosts: all
become: true
tasks:
- import_tasks: tasks/personal-linux-config.yml
- import_tasks: tasks/personal-linux-config-server.yml
- import_tasks: tasks/ssh-keys.yml

View File

@ -0,0 +1,4 @@
---
- name: Ensure the server config changes are deployed
ansible.builtin.shell:
cmd: sh -c "cd /root/personal-linux-config; bash /root/personal-linux-config/deploy.sh"

View File

@ -0,0 +1,16 @@
---
- name: Ensure the hostname package is installed and updated
ansible.builtin.apt:
update_cache: yes
cache_valid_time: 0
name: hostname
state: latest
- name: Ensure the personal-linux-config repositories is updated
ansible.builtin.git:
dest: /root/personal-linux-config
repo: https://git.bjphoster.com/b.pedini/personal-linux-config
clone: yes
update: yes
- name: Ensure the config changes are deployed
ansible.builtin.shell:
cmd: sh -c "cd /root/personal-linux-config; bash /root/personal-linux-config/deploy.sh"

26
tasks/ssh-keys.yml Normal file
View File

@ -0,0 +1,26 @@
---
- name: Ensure the .ssh folder is present and has the right permissions
ansible.builtin.file:
path: ~/.ssh
mode: 0700
state: directory
- name: Ensure the authorized_keys file is present and has the right permissions
ansible.builtin.file:
path: ~/.ssh/authorized_keys
mode: 0600
state: present
- name: Check if the "bryanpedini@bryanbox.home.bjphoster.cloud" key is present
ansible.builtin.lineinfile:
path: ~/.ssh/authorized_keys
value: |
# bryanpedini@bryanbox.home.bjphoster.cloud
check_mode: true
register: bryanbox_key
- name: Ensure the "bryanpedini@bryanbox.home.bjphoster.cloud" key is present
ansible.builtin.lineinfile:
path: ~/.ssh/authorized_keys
insertafter: EOF
value: |
# bryanpedini@bryanbox.home.bjph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