pull/11/head
Cian Hatton 3 years ago
parent f271baa7d8
commit ffc07872f4

1
.gitignore vendored

@ -1,3 +1,4 @@
.idea
venv
stack.env
linodehosts.ini

@ -1,4 +1,6 @@
[defaults]
default_module_path=library
inventory=hosts.ini
vault_password_file=.vault-pass
vault_password_file=.vault-pass.sh
host_key_checking = False
enable_plugins = linode

@ -1,2 +1,6 @@
[servers]
cianhatton@qnap
;cianhatton@qnap
root@45.33.84.25
[localhost]
localhost ansible_connection=local ansible_python_interpreter=/Users/chatton/checkouts/ansible-homelab/venv/bin/python

@ -0,0 +1,3 @@
---
# https://www.linode.com/docs/guides/deploy-linodes-using-ansible/#plugin-parameters
plugin: linode

@ -31,6 +31,7 @@ def main():
missing_volumes.append(volume_name)
for mv in missing_volumes:
if mv:
print(mv)

@ -0,0 +1,12 @@
$ANSIBLE_VAULT;1.1;AES256
36356161663039666634393933383830653035633438343866643730303434353632383031303965
3465343332353437616663643662343262373333366162300a373662386533363234636234633339
35383439373430656130353938653531636563663066646265643838323230356231333836326262
6439626538643837390a383039373366626637333738386332356361306131323133383534323462
32376564376363663666383639313064316365353037356633363035373632313561643030643933
34663533313231636162306465656433663634643038343938396462643261656238626432633136
39356562353463353034373534386537313634326534623830616362336638396337386631663538
30663236653532316461306636333536373836626537363430613961346137626261333238366234
30633438653936316539326436393634366236616664383835396434373966333166366265636661
39666335653265323565313831303264336331363339333532353939653330383362363965353032
383434386133323961373833303262336439

@ -0,0 +1,5 @@
---
# defaults file for setup_linode
ssh_keys:
- /Users/chatton/.ssh/id_rsa.pub
label: simple-linode

@ -0,0 +1,53 @@
galaxy_info:
author: your name
namespace: chatton
description: your role description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.1
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

@ -0,0 +1,16 @@
---
- name: Include vault variables.
include_vars: defaults/main-vault.yml
- name: Create a new Linode.
linode_v4:
label: "{{ label }}"
access_token: "{{ token }}"
type: g6-nanode-1
region: us-east
image: linode/debian11
root_pass: "{{ password }}"
authorized_keys: "{{ ssh_keys }}"
group: servers
state: present
register: my_linode

@ -0,0 +1,2 @@
---
# vars file for setup_linode

@ -1,7 +0,0 @@
---
- name: Converge
hosts: all
tasks:
- name: "Include chatton.samba"
include_role:
name: "chatton.samba"

@ -1,13 +0,0 @@
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: instance
image: quay.io/centos/centos:stream8
pre_build_image: true
provisioner:
name: ansible
verifier:
name: ansible

@ -1,10 +0,0 @@
---
# This is an example playbook to execute Ansible tests.
- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Example assertion
ansible.builtin.assert:
that: true

@ -1,5 +0,0 @@
---
- hosts: localhost
remote_user: root
roles:
- samba

@ -0,0 +1,7 @@
#!/bin/bash
linode_ip="$(ansible-inventory -i linode.yml --list | jq ._meta.hostvars | jq '."simple-linode"' | jq -r .ipv4[0])"
inventory_entry="root@${linode_ip}"
echo $inventory_entry
echo "[servers]" > linodehosts.ini
echo "${inventory_entry}" >> linodehosts.ini

@ -0,0 +1,7 @@
---
- hosts: localhost
become: true
vars:
ansible_python_interpreter: /Users/chatton/checkouts/ansible-homelab/venv/bin/python
roles:
- role: 'roles/setup_linode'
Loading…
Cancel
Save