Last active
June 15, 2018 16:12
-
-
Save vniche/0526f09b75c7e2e4445c7e67506ff6b0 to your computer and use it in GitHub Desktop.
Primeira tentativa da task da role ansible-resource-quota
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
# tasks/main.yml | |
--- | |
- shell: systemctl set-property haproxy.service CPUAccounting=true CPUQuota=20% MemoryLimit=10M | |
# ln -s /usr/lib/systemd/system/haproxy.service /etc/systemd/system/haproxy.service | |
- file: | |
src: /usr/lib/systemd/system/haproxy.service | |
dest: /etc/systemd/system/haproxy.service | |
state: link | |
- file: | |
path: /sys/fs/cgroup/memory/system.slice/haproxy.service | |
state: directory | |
mode: 0755 | |
# sed -i '/^ExecStart/a ExecStartPost=/bin/bash -c "echo 10M > /sys/fs/cgroup/memory/system.slice/haproxy.service/memory.limit_in_bytes"' /etc/systemd/system/haproxy.service | |
- lineinfile: | |
path: /etc/systemd/system/haproxy.service | |
regexp: "ExecStartPost=" | |
insertafter: "^ExecStart=" | |
line: 'ExecStartPost=/bin/bash -c "echo 10M > /sys/fs/cgroup/memory/system.slice/haproxy.service/memory.limit_in_bytes"' | |
# systemctl daemon-reload | |
- systemd: | |
name: haproxy | |
state: restarted | |
daemon_reload: yes |
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
# molecule/default/molecule.yml | |
--- | |
dependency: | |
name: galaxy | |
driver: | |
name: docker | |
lint: | |
name: yamllint | |
platforms: | |
- name: systemd | |
image: centos/systemd | |
command: /sbin/init | |
capabilities: | |
- SYS_ADMIN | |
volumes: | |
- "/sys/fs/cgroup:/sys/fs/cgroup:ro" | |
privileged: true | |
provisioner: | |
name: ansible | |
lint: | |
name: ansible-lint | |
scenario: | |
name: default | |
verifier: | |
name: testinfra | |
lint: | |
name: flake8 |
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
# molecule/default/prepare.yml | |
--- | |
- name: Prepare | |
hosts: all | |
gather_facts: false | |
tasks: | |
# yum install -y haproxy | |
- yum: | |
name: haproxy | |
state: installed | |
# systemctl start haproxy | |
- systemd: | |
name: haproxy | |
enabled: yes | |
state: started |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment