Ansible Setup » History » Version 32
Jon Goldberg, 08/28/2024 05:25 AM
| 1 | 18 | Jon Goldberg | {{last_updated_at}} by {{last_updated_by}} |
|---|---|---|---|
| 2 | |||
| 3 | 1 | Jon Goldberg | # Ansible Setup |
| 4 | |||
| 5 | 13 | Jon Goldberg | Ansible setup is now done through Ansible itself plus a short bootstrap script. Please check earlier revisions of this page for manual setup. |
| 6 | 1 | Jon Goldberg | |
| 7 | 13 | Jon Goldberg | ### Prerequisites |
| 8 | * You have sudo installed and you have sudo permissions. |
||
| 9 | 32 | Jon Goldberg | * Run `sudo apt install` in your terminal to check. |
| 10 | 13 | Jon Goldberg | * You have a GPG key pair and SSH key pair on this computer. |
| 11 | 32 | Jon Goldberg | * SSH Key: `ssh-keygen -t ed25519` |
| 12 | 13 | Jon Goldberg | * Your SSH public key for this computer must be added to your Gitea account. Ideally it's also on other servers. |
| 13 | 28 | Brienne Kordis | * In Gitea, go to **Settings > SSH / GPG Keys > Add Key** |
| 14 | * In your terminal, `cd .ssh` from your home directory |
||
| 15 | * Use either `nano` or `code` to open id_rsa.pub (if using nano, make sure to grab the full key!) |
||
| 16 | * Paste the key where prompted in Gitea |
||
| 17 | 25 | Jon Goldberg | * Your GPG public key must be added to the pass database, and it must be signed by Jon. ([transferring a key instructions here](https://linuxhint.com/export-import-keys-with-gpg/)) |
| 18 | 14 | Jon Goldberg | * Nextcloud should be installed. |
| 19 | 13 | Jon Goldberg | NOTE: You can bootstrap without adding your server to crm.megaphonetech.com, but after bootstrap your server must be in the inventory. |
| 20 | 1 | Jon Goldberg | |
| 21 | 24 | Jon Goldberg | ### Bootstrap stage 1 script |
| 22 | 13 | Jon Goldberg | Run these commands: |
| 23 | 26 | Jon Goldberg | [**NOTE**: There's a bug in Ubuntu 22.10 (and newer Debian) that prohibits downloading with ansible-galaxy. Comment out the step in localhost-bootstrap.yml and install manually in ~/.ansible/collections.) |
| 24 | 11 | Jon Goldberg | |
| 25 | 1 | Jon Goldberg | ```shell |
| 26 | sudo apt install ansible git |
||
| 27 | 24 | Jon Goldberg | git clone https://github.com/MegaphoneJon/ansible-main.git ansible --recursive |
| 28 | 13 | Jon Goldberg | cd ansible |
| 29 | 31 | Jon Goldberg | # Check out the "host_vars" repo, which has customizations for specific servers |
| 30 | git clone git@git.megaphonetech.com:megaphone/ansible_host_vars.git |
||
| 31 | 24 | Jon Goldberg | # run the bootstrap stage 2. You'll be prompted for your 'BECOME password'; it's your user pw (for sudo). |
| 32 | ansible-playbook localhost-bootstrap.yml --inventory localhost, --ask-become-pass --extra-vars "ansible_user=ansible" |
||
| 33 | 30 | Brienne Kordis | ansible-playbook provision.yml -limit [server_name] |
| 34 | 13 | Jon Goldberg | ``` |