Skip to content

Commit 5392f5b

Browse files
committed
ansible: remove bitwarden plugin, upgrade ansible
1 parent 26926f0 commit 5392f5b

File tree

5 files changed

+77
-243
lines changed

5 files changed

+77
-243
lines changed

ansible.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use_persistent_connections = true
1212
# human-readable stdout/stderr results display
1313
stdout_callback = debug
1414
# Avoid default Python warnings
15-
interpreter_python = auto
15+
interpreter_python = auto_silent
1616
# https://github.com/ansible/ansible/issues/56930
1717
force_valid_group_names = ignore
1818

ansible/README.md

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Description
2+
3+
Herein lie all ansible related files __except__ for `ansible.cfg` at the root of the repo for easier usage without having to `cd` here.
4+
5+
# Usage
6+
7+
Simply run the play related to the specific type of configuration you want to deploy:
8+
```sh
9+
> ls -1 ansible/*.yml
10+
ansible/bootstrap.yml
11+
ansible/upgrade.yml
12+
ansible/main.yml
13+
```
14+
```sh
15+
ansible-playbook ansible/main.yml
16+
```
17+
18+
# Bootstrap
19+
20+
All hosts are bootstraped right after provisioning using these roles:
21+
22+
* [status-im/infra-role-bootstrap-linux](https://github.com/status-im/infra-role-bootstrap-linux)
23+
* [status-im/infra-role-bootstrap-macos](https://github.com/status-im/infra-role-bootstrap-macos)
24+
* [status-im/infra-role-bootstrap-windows](https://github.com/status-im/infra-role-bootstrap-windows)
25+
26+
If you want to re-run any bootstrap step you can do it like so:
27+
```sh
28+
ansible-playbook ansible/bootstrap.yml -t role::bootstrap:hostname
29+
```
30+
In this case only the `hostname` set of tasks will be executed due to the `role::bootstrap:hostname` tag.
31+
32+
# Inventory
33+
34+
The inventory we use is crated by Terraform via the [`terraform-provider-ansible`](https://github.com/nbering/terraform-provider-ansible) which generates the necessary data structures in the [Consul Key/Value store](https://www.consul.io/docs/dynamic-app-config/kv) that is later used by the [`terraform.py`](./terraform.py) script to provide hosts and their variables to Ansible.
35+
36+
Some ways to view existing hosts:
37+
```sh
38+
ansible localhost -m debug -a 'var=groups'
39+
ansible all -o -m debug -a 'var=ansible_host' | columns -t
40+
```
41+
42+
A backup of the Terraform state is created at `.terraform/terraform.tfstate.backup`. It is symetrically encrypted using [Fernet algorithm](https://cryptography.io/en/latest/fernet/) with a key generated from haed `CONSUL_HTTP_TOKEN` and can be decrypted by using [`decrypt_tf_backup.py`](https://github.com/status-im/infra-utils/blob/master/terraform/decrypt_tf_backup.py) script.
43+
44+
# Variables
45+
46+
Ansible variables can be provided to Ansible using the `--extra-vars`/`-e` flag. An example of such a flag is:
47+
```yaml
48+
compose_state: 'present'
49+
compose_recreate: 'smart'
50+
compose_restart: false
51+
```
52+
53+
These are used in every role that starts docker containers. You can use them to change the behaviour of roles.
54+
For example to re-create all metric related containers use:
55+
```sh
56+
ansible-playbook ansible/main.yml -e compose_recreate=always
57+
```
58+
59+
# Secrets
60+
61+
Secrets are stored and provided in three ways:
62+
63+
* [password-store](https://www.passwordstore.org/) - Using [`passwordstore`](https://docs.ansible.com/ansible/latest/collections/community/general/passwordstore_lookup.html) plugin for core infra secrets.
64+
* [Vault](https://www.vaultproject.io/) - Using [`vault`](./lookup_plugins/vault.py) plugin for service secrets.
65+
66+
Read [secrets management guide](https://docs.infra.status.im/guides/secret_management.html) for more details.

ansible/lookup_plugins/bitwarden.py

-227
This file was deleted.

flake.lock

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+6-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
{
22
description = "infra-shell";
33

4-
# bitwarden-cli has a build issue on macOS since 2024.8.0:
5-
# this commit fixes nixpkgs right before switching to 2024.8.0
6-
# https://github.com/NixOS/nixpkgs/issues/339576
7-
inputs.nixpkgs.url = "github:nixos/nixpkgs/c374d94f1536013ca8e92341b540eba4c22f9c62";
8-
#inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
4+
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
95

106
outputs = { self, nixpkgs }:
117
let
@@ -19,11 +15,10 @@
1915
pkgs = pkgsFor.${system};
2016
in {
2117
default = let
22-
pythonPkgs = pkgs.python3.withPackages (
23-
_: with (pkgs.python3Packages); [
18+
pythonPkgs = pkgs.python312.withPackages (
19+
_: with (pkgs.python312Packages); [
2420
ipython pyyaml jinja2 PyGithub
25-
pyopenssl cryptography
26-
hvac
21+
pyopenssl cryptography hvac
2722
]
2823
);
2924
in pkgs.mkShellNoCC {
@@ -33,9 +28,9 @@
3328
# networking
3429
curl nmap nettools dnsutils
3530
# infra
36-
terraform ansible_2_16 pythonPkgs
31+
terraform ansible_2_17 pythonPkgs
3732
# security
38-
pass vault bitwarden-cli yubikey-manager pwgen
33+
pass vault yubikey-manager pwgen
3934
# cloud
4035
aliyun-cli awscli doctl google-cloud-sdk
4136
hcloud s3cmd scaleway-cli

0 commit comments

Comments
 (0)