Network/Ansible: Difference between revisions

From NURDspace
No edit summary
No edit summary
 
(12 intermediate revisions by 2 users not shown)
Line 2: Line 2:
|Name=Ansible
|Name=Ansible
|Skills=Sysadmin stuff,
|Skills=Sysadmin stuff,
|Status=R&D
|Status=Active
|Picture=Ansible-logo.png
|Picture=Ansible-logo.png
|Tool=No
|Tool=Yes
}}
}}


== Code ==
== Code ==
The codebase that is used to manage our infra can be found [[https://github.com/NURDspace/operations|on github]]. Note that this repo is marked as private since it contains secrets stored in an ansible-vault
The codebase that is used to manage our infra can be found [https://git.nurd.space/bofh/ansible|on our gitlab]. Note that this repo is marked as private since it contains secrets stored in an ansible-vault.
 
== Deployment of code ==
We use [https://github.com/teslamotors/ansible_puller ansible-puller] on each managed system which pulls the code from a repository. This is scheduled to run each hour. During development you can test code using the <tt>debug-ansible-playbook</tt> command manually.


== Setting it up ==
== Setting it up ==
First, ask someone to add you to the nurdspace organization. Next, use git to checkout this codebase:
Make sure you have the following dependencies installed. Note that this documentation assumes a linux based system. You are on your own if you use something different. Also, be very, very careful if you edit these files under windows, since that can mangle the line endings. This code will break unless you use LF line endings.


cd git
* ansible
git clone git@github.com:NURDspace/operations.git
* ansible-vault
* git


== Making changes ==
== Making changes ==
For now, everyone who has write access to this repo is able to make changes. This implies that you *must* keep your local copy uptodate and be aware of merge conflicts whenever you commit. In the future, we might move to gitops.
We use GitOps to deploy changes onto this system. This means that you always need to commit your code to gitlab before you can deploy changes onto a system. Once your code is committed, login to a system and run the <tt>debug-ansible-playbook</tt> command. By default, this will use <tt>site.yml</tt> as the playbook. Optionally, you can pass a custom playbook for more rapid development.

Latest revision as of 21:55, 6 September 2024

Ansible
Ansible-logo.png
Participants
Skills Sysadmin stuff
Status Active
Niche
Purpose
Tool Yes
Location
Cost
Tool category

Ansible

Ansible-logo.png {{#if:Yes | [[Tool Owner::{{{ProjectParticipants}}} | }} {{#if:Yes | [[Tool Cost::{{{Cost}}} | }}


Code

The codebase that is used to manage our infra can be found our gitlab. Note that this repo is marked as private since it contains secrets stored in an ansible-vault.

Deployment of code

We use ansible-puller on each managed system which pulls the code from a repository. This is scheduled to run each hour. During development you can test code using the debug-ansible-playbook command manually.

Setting it up

Make sure you have the following dependencies installed. Note that this documentation assumes a linux based system. You are on your own if you use something different. Also, be very, very careful if you edit these files under windows, since that can mangle the line endings. This code will break unless you use LF line endings.

  • ansible
  • ansible-vault
  • git

Making changes

We use GitOps to deploy changes onto this system. This means that you always need to commit your code to gitlab before you can deploy changes onto a system. Once your code is committed, login to a system and run the debug-ansible-playbook command. By default, this will use site.yml as the playbook. Optionally, you can pass a custom playbook for more rapid development.