-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ansible playbooks for server control via IPMI
- Loading branch information
Showing
6 changed files
with
77 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Ansible Playbooks | ||
|
||
## Requirements | ||
|
||
* Python 3 | ||
|
||
## Installation | ||
|
||
```sh | ||
python3 -m pip install --user ansible pyghmi | ||
``` | ||
|
||
## Usage | ||
|
||
```sh | ||
ansible-playbook <name> | ||
``` | ||
|
||
## Vault | ||
|
||
* GPG key is required to decrypt vault's key | ||
|
||
```sh | ||
ansible-vault edit secrets.yml | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
$ANSIBLE_VAULT;1.1;AES256 | ||
36303964646562316638333136326439333564383236356661396366623431353234626663663534 | ||
3263616362333265383835316163633734306465363461660a373838323334383139393766336262 | ||
38383735386562356536653535333565356232323161623435303164363239613234386365393161 | ||
3065313465356536370a326139366162613439333731623464343635373831336264653132663661 | ||
64316165646662333432326265396663326232343237343461323038656237316637613631643563 | ||
66303532313563663132653061356563613138626136363932366137326565643331376437353734 | ||
39313065626430393137643734633439623037653736373366396231353132343735643461343661 | ||
65613138303763643639353936303038653839616165353139323637313539646530373665353634 | ||
63636331306339313034326339646331626339353665356435373437643130303561 | ||
35666564353831313765653331653537373532616236343638613566376139383933353936363961 | ||
3232386632373839613131363534353661326437653866610a343562653766633266326636393735 | ||
35396131613065313466303134623866666131646465616630383935363165383630373533383463 | ||
3739373964346164320a626632316132376439373363323664303263636230346235656462393830 | ||
64326362623837373335613963363238646436303839616631653663333632623930343937366232 | ||
37653935303236356634343938333662616336616137636462636534393239613835326439646433 | ||
366163353761373062656437616233643730 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
- name: "Ping servers" | ||
hosts: "servers" | ||
gather_facts: false | ||
tasks: | ||
- name: "Ping server" | ||
ansible.builtin.ping: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
- name: "Power on servers" | ||
gather_facts: false | ||
vars_files: | ||
- "../secrets.yml" | ||
hosts: "localhost" | ||
tasks: | ||
- name: "Power on via IPMI" | ||
community.general.ipmi_power: | ||
name: "192.168.0.5" | ||
user: "{{ ipmi.username }}" | ||
password: "{{ ipmi.password }}" | ||
state: "on" | ||
delegate_to: "localhost" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
- name: "Reboot servers" | ||
gather_facts: false | ||
vars_files: | ||
- "../secrets.yml" | ||
hosts: "localhost" | ||
tasks: | ||
- name: "Reboot via IPMI" | ||
community.general.ipmi_power: | ||
name: "192.168.0.5" | ||
user: "{{ ipmi.username }}" | ||
password: "{{ ipmi.password }}" | ||
state: "reset" | ||
delegate_to: "localhost" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
- name: "Shutdown servers" | ||
gather_facts: false | ||
vars_files: | ||
- "../secrets.yml" | ||
hosts: "localhost" | ||
tasks: | ||
- name: "Shutdown via IPMI" | ||
community.general.ipmi_power: | ||
name: "192.168.0.5" | ||
user: "{{ ipmi.username }}" | ||
password: "{{ ipmi.password }}" | ||
state: "shutdown" | ||
delegate_to: "localhost" |