You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

26 lines
715 B

---
- hosts: localhost
connection: local
gather_facts: no
vars:
HCLOUD_TOKEN: "{{ lookup('env', 'HCLOUD_TOKEN') }}"
collections:
- hetzner.hcloud
tasks:
- name: create a server that ansible-pulls this repo
hcloud_server:
api_token: "{{ HCLOUD_TOKEN }}"
name: my-server
server_type: cx11
image: ubuntu-20.04
location: fsn1
state: present
user_data: |
#!/bin/bash
apt update
apt install git ansible -y
ln -s /usr/bin/python3 /usr/bin/python
ansible-pull -U https://git.osuv.de/m/server -i inventories/local.ini localhost.yml --extra-vars='{"USER": "user", "PASSWORD": "password"}'