Last active
August 29, 2015 14:07
-
-
Save masaki-ahiru/67004ff6c9fef06b3d59 to your computer and use it in GitHub Desktop.
mackerel-agent インストール用の Ansible Playbook です。
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
mackerel_install.yaml の使い方 | |
============================== | |
## 編集 | |
自分の環境に併せて、hosts,remote_user,sudo を変更してください。 | |
## 実行 | |
自分のMackerelアカウントのAPIキーを以下のhogehogeに代入して、実行してください。 | |
$ ansible-playbook mackerel_install.yaml --extra-vars "APIkey=hogehoge" | |
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
--- | |
- hosts: example-hosts | |
remote_user: example-user | |
sudo: yes | |
tasks: | |
- name: setting yum script | |
shell: curl -fsSL https://mackerel.io/assets/files/scripts/setup-yum.sh | sh | |
when: ansible_os_family == 'RedHat' | |
- name: yum install mackerel-agent | |
yum: name=mackerel-agent state=present | |
when: ansible_os_family == 'RedHat' | |
- name: setting apt script | |
shell: curl -fsSL https://mackerel.io/assets/files/scripts/setup-apt.sh | sh | |
when: ansible_os_family == 'Debian' | |
- name: apt-get install mackerel-agent | |
apt: name=mackerel-agent state=present | |
when: ansible_os_family == 'Debian' | |
- name: setting API Key | |
shell: sed -i 's/# apikey = ""/apikey = "'{{ APIkey }}'"/g' /etc/mackerel-agent/mackerel-agent.conf | |
- name: restart mackerel-agent | |
service: name=mackerel-agent state=restarted | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment