Skip to content

Commit

Permalink
Merge branch 'main' into cleanup-tag
Browse files Browse the repository at this point in the history
  • Loading branch information
nahsi authored Nov 4, 2024
2 parents 9bd70d0 + 7f43136 commit 2f32016
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/release-please/manifest.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{".":"0.3.10"}
{".":"0.3.11"}
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## [0.3.11](https://github.com/fluencelabs/ansible/compare/v0.3.10...v0.3.11) (2024-10-02)


### Features

* Add ability to configure nox log level ([#60](https://github.com/fluencelabs/ansible/issues/60)) ([a8df7ec](https://github.com/fluencelabs/ansible/commit/a8df7ecdc076a636a80cb35d7d9af7c91b4d2198))
* Backup nox secrets dir localy ([#61](https://github.com/fluencelabs/ansible/issues/61)) ([2319dde](https://github.com/fluencelabs/ansible/commit/2319dde40bfcfd24da2fabcf6711eb9dc7830728))


### Bug Fixes

* Fix errors with virtualization permissions and increase file limits ([#63](https://github.com/fluencelabs/ansible/issues/63)) ([ebb574f](https://github.com/fluencelabs/ansible/commit/ebb574fe813173a7eb4a8f821950bc622ce79d50))
* Set limits for `nox_user` ([#64](https://github.com/fluencelabs/ansible/issues/64)) ([97006ed](https://github.com/fluencelabs/ansible/commit/97006ed69cabd7ca3bd8f0d81e9d0e9261207747))

## [0.3.10](https://github.com/fluencelabs/ansible/compare/v0.3.9...v0.3.10) (2024-09-18)


Expand Down
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace: fluencelabs
name: provider
version: 0.3.10
version: 0.3.11
readme: README.md
authors:
- Anatolios Laskaris <[email protected]> (https://nahsi.dev)
Expand Down
10 changes: 10 additions & 0 deletions roles/nox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ Should be put to `files/` directory where you run this role.
- version of nox
- type: string

#### `nox_log_level`

- log level passed to `RUST_LOG` variable. Individual components log level can
me set like this `nox_log_level: "info,chain-listener=debug"`
- type: string
- default:
```yml
nox_log_level: "info"
```
#### `nox_dir`

- root nox directory
Expand Down
3 changes: 2 additions & 1 deletion roles/nox/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ nox_dir: "/opt/fluence/nox"
nox_project_dir: ""
nox_group: "nox"
nox_user: "nox"
nox_log_level: "info"
nox_branch: ""
nox_local_backup_dir: "files/{{ fluence_project_dir }}/backups"
nox_unit_file: |
Expand All @@ -15,7 +16,7 @@ nox_unit_file: |
Environment="FLUENCE_CONFIG={{ nox_dir }}/Config.toml"
Environment="FLUENCE_BASE_DIR={{ nox_dir }}/state"
Environment="FLUENCE_ROOT_KEY_PAIR__PATH={{ nox_dir }}/state/root_secret_key.ed25519"
Environment="RUST_LOG=info,chain-listener=debug,chain-connector=debug"
Environment="RUST_LOG={{ nox_log_level }}"
ExecStart={{ nox_dir }}/nox
Restart=on-failure
User=root
Expand Down
58 changes: 58 additions & 0 deletions roles/nox/tasks/01-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
system: true
shell: "/sbin/nologin"
group: "{{ nox_group }}"
groups:
- libvirt
create_home: false
state: present

Expand All @@ -29,6 +31,62 @@
tags:
- uninstall

- name: add nox user to libvirt group
ansible.builtin.user:
name: "libvirt-qemu"
groups:
- "{{ nox_group }}"
create_home: false
state: present

- name: increase ulimits for nox user
ansible.builtin.pam_limits:
args: "{{ limit }}"
loop_control:
loop_var: "limit"
label: "{{ limit.domain }} {{ limit.limit_item }}:{{ limit.limit_type }}"
loop:
- domain: "{{ nox_user }}"
limit_type: "hard"
limit_item: "nofile"
comment: "Increse max open file hard limit"
value: 65536
- domain: "{{ nox_user }}"
limit_type: "soft"
limit_item: "nofile"
comment: "Increse max open file soft limit"
value: 65536

- name: cleanup nox state
ansible.builtin.file:
path: "{{ nox_dir }}"
state: absent
when: nox_cleanup_state

- name: cleanup VMs if any
block:
- name: List all VMs
community.libvirt.virt:
command: list_vms
register: all_vms

- debug:
msg: "{{ item }}"
loop: "{{ all_vms.list_vms }}"

- name: "Destroy vm {{ item }}"
community.libvirt.virt:
name: "{{ item }}"
command: destroy
loop: "{{ all_vms.list_vms }}"

- name: "Undefine vm {{ item }}"
community.libvirt.virt:
name: "{{ item }}"
command: undefine
loop: "{{ all_vms.list_vms }}"
when: nox_cleanup_state

- name: create nox directories
ansible.builtin.file:
path: "{{ nox_dir }}/state"
Expand Down
2 changes: 1 addition & 1 deletion roles/prerequisites/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
state: started
enabled: true
daemon_reload: true

- name: enable default network
community.libvirt.virt_net:
autostart: true
Expand Down

0 comments on commit 2f32016

Please sign in to comment.