diff --git a/README.md b/README.md new file mode 100644 index 0000000..a85ad2f --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# γ + +## Setup + +```sh +sudo apt install ansible +ansible-playbook setup.yml +``` + +詳しい構成は [setup.yml](setup.yml) を参照 diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..76ada53 --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,2 @@ +[defaults] +inventory = etc/ansible/hosts diff --git a/etc/ansible/hosts b/etc/ansible/hosts new file mode 100644 index 0000000..b9449f7 --- /dev/null +++ b/etc/ansible/hosts @@ -0,0 +1,5 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/inventory.json +all: + hosts: + beta.fogtype.com: + gamma.fogtype.com: diff --git a/setup.yml b/setup.yml new file mode 100644 index 0000000..d3c7ee0 --- /dev/null +++ b/setup.yml @@ -0,0 +1,35 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/ansible.json#/$defs/playbook +- hosts: all + remote_user: ubuntu + vars_prompt: + - name: grafana_gcloud_api_key + prompt: GCLOUD_API_KEY + tasks: + - name: Grafana Cloud + ansible.builtin.shell: | + ARCH=amd64 GCLOUD_STACK_ID="373424" GCLOUD_API_URL="https://integrations-api-us-central.grafana.net" /bin/sh -c "$(curl -fsSL https://raw.githubusercontent.com/grafana/agent/release/production/grafanacloud-install.sh)" + sed -i "s/ hostname\$/ $(hostname)/" /etc/grafana-agent.yaml + systemctl restart grafana-agent.service + become: true + environment: + GCLOUD_API_KEY: "{{ grafana_gcloud_api_key }}" + - ansible.builtin.apt_repository: + filename: docker + repo: deb [trusted=yes] https://download.docker.com/linux/ubuntu jammy stable + become: true + - ansible.builtin.apt_repository: + filename: tailscale + repo: deb [trusted=yes] https://pkgs.tailscale.com/stable/ubuntu jammy main + become: true + - ansible.builtin.apt: + pkg: + - docker-ce + - tailscale + install_recommends: false + become: true + - ansible.builtin.user: + name: "{{ ansible_user_id }}" + groups: docker + append: true + become: true + - ansible.builtin.meta: reset_connection