diff --git a/bootstrap.sh b/bootstrap.sh index 94e2165..2a1a2e7 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,6 +1,6 @@ #!/bin/sh -read -p "Enter root password" password +read -p "Enter root password : " password # Update APT repos sudo apt update @@ -16,8 +16,7 @@ pipx ensurepath pipx install --include-deps ansible # Install passlib (for ssh password connection) -sudo apt install python3-passlib -pipx inject ansible passlib +sudo apt install sshpass # Make sure git is installed sudo apt install git @@ -25,4 +24,4 @@ sudo apt install git # Clone ansible_playbooks repo git clone https://git.athelas-conseils.fr/Stage/ansible_playbooks.git -ansible-playbook ansible_playbooks/tasks/full_setup.yml -i ansible_playbooks/inventory.ini --extra-vars "ansible_ssh_pass=$password" \ No newline at end of file +~/.local/bin/ansible-playbook ansible_playbooks/tasks/full_setup.yml -i ansible_playbooks/inventory.ini --extra-vars "ansible_ssh_pass=$password ansible_ssh_common_args='-o StrictHostKeyChecking=no'" \ No newline at end of file diff --git a/tasks/install_caddy.yml b/tasks/install_caddy.yml index a7a2048..a25b68b 100644 --- a/tasks/install_caddy.yml +++ b/tasks/install_caddy.yml @@ -26,12 +26,12 @@ - name: Editing Caddyfile to setup the reverse_proxy ansible.builtin.template: - src: ~/ansible/templates/Caddyfile.j2 + src: templates/Caddyfile.j2 dest: /etc/caddy/Caddyfile - name: Put the service binary on the remote server ansible.builtin.copy: - src: ~/ansible/files/usertwist + src: files/usertwist dest: /usr/local/bin owner: root group: root @@ -39,7 +39,7 @@ - name: Put the service systemd file on the remote server ansible.builtin.copy: - src: ~/ansible/files/usertwist.service + src: files/usertwist.service dest: /etc/systemd/system owner: root group: root diff --git a/tasks/setup_ssh.yml b/tasks/setup_ssh.yml index 642e4b0..de9c255 100644 --- a/tasks/setup_ssh.yml +++ b/tasks/setup_ssh.yml @@ -9,19 +9,19 @@ - name: Get SSH Private Key ansible.builtin.fetch: - dest: "~/ansible/keys/" + dest: "keys/" src: "~/ssh_key" flat: true - name: Get SSH Public Key ansible.builtin.fetch: - dest: "~/ansible/keys/" + dest: "keys/" src: "~/ssh_key.pub" flat: true - name: Copy new SSH configuration ansible.builtin.template: - src: "~/ansible/templates/sshd_config.j2" + src: "templates/sshd_config.j2" dest: "/etc/ssh/sshd_config" - name: Create new user @@ -40,7 +40,7 @@ - name: Add SSH public key to remote host ansible.builtin.authorized_key: user: "motysten" - key: "{{ lookup('file', '~/ansible/keys/ssh_key.pub') }}" + key: "{{ lookup('file', 'keys/ssh_key.pub') }}" become: true - name: Restart SSH Services