├── hosts ├── roles └── chaitanyaenr.tuned │ ├── vars │ └── main.yml │ ├── defaults │ └── main.yml │ ├── handlers │ └── main.yml │ ├── tests │ ├── inventory │ └── test.yml │ ├── meta │ ├── .galaxy_install_info │ └── main.yml │ ├── tasks │ └── main.yml │ ├── README.md │ └── .travis.yml ├── README.md └── tuned.yml /hosts: -------------------------------------------------------------------------------- 1 | [tuned] 2 | -------------------------------------------------------------------------------- /roles/chaitanyaenr.tuned/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # vars file for tuned 3 | -------------------------------------------------------------------------------- /roles/chaitanyaenr.tuned/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # defaults file for tuned 3 | -------------------------------------------------------------------------------- /roles/chaitanyaenr.tuned/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # handlers file for tuned 3 | -------------------------------------------------------------------------------- /roles/chaitanyaenr.tuned/tests/inventory: -------------------------------------------------------------------------------- 1 | localhost ansible_connection=local 2 | -------------------------------------------------------------------------------- /roles/chaitanyaenr.tuned/meta/.galaxy_install_info: -------------------------------------------------------------------------------- 1 | {install_date: 'Wed Jul 6 21:16:04 2016', version: master} 2 | -------------------------------------------------------------------------------- /roles/chaitanyaenr.tuned/tests/test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | remote_user: root 4 | roles: 5 | - role: tuned 6 | -------------------------------------------------------------------------------- /roles/chaitanyaenr.tuned/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: install tuned via dnf 3 | dnf: name={{ item }} state=latest 4 | with_items: 5 | - tuned 6 | when: ansible_pkg_mgr == 'dnf' 7 | 8 | - name: install tuned via yum 9 | yum: name={{ item }} state=latest 10 | with_items: 11 | - tuned 12 | when: ansible_pkg_mgr == 'yum' 13 | 14 | - name: start tuned 15 | service: name=tuned state=started enabled=yes 16 | -------------------------------------------------------------------------------- /roles/chaitanyaenr.tuned/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | author: Naga Ravi Chaitanya Elluri 4 | description: Installs tuned and enables it. 5 | company: redhat 6 | license: BSD 7 | min_ansible_version: 1.2 8 | platforms: 9 | - name: EL 10 | versions: 11 | - all 12 | - name: Fedora 13 | versions: 14 | - all 15 | galaxy_tags: 16 | - installer 17 | - application 18 | - system 19 | dependencies: [] 20 | -------------------------------------------------------------------------------- /roles/chaitanyaenr.tuned/README.md: -------------------------------------------------------------------------------- 1 | Ansible Role: Tuned 2 | ========= 3 | An Ansible role that installs Tuned, starts and enables it on RHEL, Fedora and Centos. 4 | 5 | Example Playbook 6 | ---------------- 7 | 8 | Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: 9 | 10 | - hosts: servers 11 | roles: 12 | - role: tuned 13 | 14 | License 15 | ------- 16 | 17 | BSD 18 | 19 | Author Information 20 | ------------------ 21 | 22 | Naga Ravi Chaitanya Elluri - nelluri@redhat.com 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ansible-tuned 2 | 3 | #### start profile 4 | Run the playbook to install tuned on all the hosts mentioned under tuned group in inventory and start a profile 5 | $ ansible-playbook --extra-vars '{ "PROFILE":" " }' tuned.yml 6 | 7 | #### Disable all the running profiles 8 | $ ansible-playbook --extra-vars '{ "DISABLE":"yes" }' tuned.yml 9 | 10 | #### Recommend a profile and start it 11 | $ ansible-playbook --extra-vars '{ "RECOMMEND":"yes" }' tuned.yml 12 | 13 | #### start your own profile 14 | $ ansible-playbook --extra-vars '{ "PROFILE_NAME":"name-of-the profile", "PROFILE_PATH": "path-to-your-profile" }' tuned.yml 15 | -------------------------------------------------------------------------------- /roles/chaitanyaenr.tuned/.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: python 3 | python: "2.7" 4 | 5 | # Use the new container infrastructure 6 | sudo: false 7 | 8 | # Install ansible 9 | addons: 10 | apt: 11 | packages: 12 | - python-pip 13 | 14 | install: 15 | # Install ansible 16 | - pip install ansible 17 | 18 | # Check ansible version 19 | - ansible --version 20 | 21 | # Create ansible.cfg with correct roles_path 22 | - printf '[defaults]\nroles_path=../' >ansible.cfg 23 | 24 | script: 25 | # Basic role syntax check 26 | - ansible-playbook tests/test.yml -i tests/inventory --syntax-check 27 | 28 | notifications: 29 | webhooks: https://galaxy.ansible.com/api/v1/notifications/ -------------------------------------------------------------------------------- /tuned.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: tuned 3 | user: root 4 | roles: 5 | - role: chaitanyaenr.tuned 6 | vars: 7 | - profile: "{{ PROFILE }}" 8 | - disable: "{{ DISABLE|default(' ') }}" 9 | - recommend: "{{ RECOMMEND|default(' ') }}" 10 | - profile_path: "{{ PROFILE_PATH }}" 11 | - profile_name: "{{ PROFILE_NAME }}" 12 | - tuned_profile_path: /usr/lib/tuned/ 13 | tasks: 14 | - name: start-profile 15 | shell: tuned-adm profile "{{ profile }}" 16 | when: profile is defined 17 | - name: Disable profile 18 | shell: tuned-adm off 19 | when: disable == "yes" 20 | - name: recommend profile 21 | command: tuned-adm recommend 22 | register: get_profile 23 | - name: start the recommended profile 24 | shell: tuned-adm profile "{{ get_profile.stdout }}" 25 | when: recommend == "yes" 26 | - name: start your written profile 27 | copy: src={{ profile_path }} dest={{ tuned_profile_path }} 28 | when: profile_path is defined 29 | - name: start user-profile 30 | shell: tuned-adm profile "{{ profile_name }}" 31 | when: profile_path is defined 32 | --------------------------------------------------------------------------------