Skip to content
This repository was archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
Initial commit for Ansible based Satellite6 Install and Configure.
Browse files Browse the repository at this point in the history
* Added a partition-disk role
* Added playbooks for sat63 and sat64

Signed-off-by: Kedar Bidarkar <[email protected]>
  • Loading branch information
kbidarkar authored and chris1984 committed Jul 19, 2018
1 parent 60fa102 commit 4f86d26
Show file tree
Hide file tree
Showing 20 changed files with 304 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Generic Files
*~
*.swp

log/
logs-*/

# Byte-compiled / optimized / DLL files
__pycache__/
venv/
env/
*.pyc

# C extensions
*.so

# Distribution / packaging
.Python
env/
bin/
build/
develop-eggs/
dist/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject
.settings/


# Sphinx documentation
docs/_build/

# Ansible
*.retry

27 changes: 27 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Contributing to Ansible-Satellite6
==================================

To contribute to ansible-satellite6, please use pull requests on a branch of your own fork.

After creating your fork on github, you can do:
```
git clone [email protected]:yourname/ansible-satellite6
cd ansible-satellite6
git checkout -b your-branch-name
DO SOME CODING HERE
git add your new files
git commit
git push origin your-branch-name
```
You will then be able to create a pull request from your commit.

All fixes or new addition to the project should be accompanied by tests that
should PASS.

Feel free to raise issues in the repo if you feel a fix or new feature support is needed.

Standards
=========
Install and Run [ansible-lint](https://github.com/willthames/ansible-lint) against your code changes.

Also, Install and Run [ansible-review](https://github.com/willthames/ansible-review) against your code changes.
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# ansible-satellite6

Ansible playbooks for Satellite 6 systems' management.

## Setup

### Prerequisities

This repository will be Python3.6 based.

You need Ansible installed.

We also recommend to install ansible-lint and ansible-review.

### Configuration

Befor running any Satellite6 playbooks,

1. Check and Install the roles from ansible galaxy, if any

```
# ansible-galaxy install -r requirements.yml
```

2. Check and configure required variables
(i.e RHSM Credentials, Satellite setup links and so on).

3. Make a copy of inventory from inventory.sample file.

```
# cp inventory.sample inventory
```

4. Make sure that SSH Keys are exchanged and placed for the user root.

```
# ssh-copy-id [email protected]
```

## Usage

### To Install and configure Satellite6:

```
$ ansible-playbook -i inventory playbooks/install/satellite_63.yml
```

## Contributing

Please read [CONTRIBUTING.md](https://github.com/SatelliteQE/ansible-satellite6/blob/master/CONTRIBUTING.md) if you wish to contribute.

6 changes: 6 additions & 0 deletions ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[defaults]
library = foreman-ansible-modules/modules
module_utils = foreman-ansible-modules/module_utils
roles_path = $PWD/galaxy_roles:$PWD/roles
inventory = inventory
retry_files_enabled = False
5 changes: 5 additions & 0 deletions inventory.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[sat63]
sat63-rhel7 ansible_ssh_host=sat63-rhel7.example.com ansible_user=root

[sat64]
sat64-rhel7 ansible_ssh_host=sat64-rhel7.example.com ansible_user=root
4 changes: 4 additions & 0 deletions playbooks/install/satellite_63.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
- hosts: sat63
roles:
- partition-disk
4 changes: 4 additions & 0 deletions playbooks/install/satellite_64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
- hosts: sat64
roles:
- partition-disk
Empty file.
Empty file.
2 changes: 2 additions & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# from galaxy
# - src: username.rolename
44 changes: 44 additions & 0 deletions roles/partition-disk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Ansible Role for Partitioning Disk
==================================

This Ansible role removes home partition and extends root partition.

Requirements
------------

No Requirements are required for this role.

Role Variables
--------------

No variables required for this role.

Dependencies
------------

This role is not dependent upon any galaxy roles.

Example Playbook
----------------

Here is a simple example of partitioning-disk role:

- hosts: localhost
remote_user: root
roles:
- partition-disk

License
-------

GNU GENERAL PUBLIC LICENSE

Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc.


Author Information
------------------

This is developed by Satellite QE team, irc: #robottelo on Freenode
2 changes: 2 additions & 0 deletions roles/partition-disk/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# defaults file for partition-disk
2 changes: 2 additions & 0 deletions roles/partition-disk/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# handlers file for partition-disk
50 changes: 50 additions & 0 deletions roles/partition-disk/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
galaxy_info:
author: Satellite QE Team
description: Satellite QE Team
company: RedHat

# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker

# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: GPLv3

min_ansible_version: 1.2

# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:

# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If Travis integration is configured, only notifications for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:

#
# platforms is a list of platforms, and each platform has a name and a list of versions.
#
platforms:
- name: RHEL
versions:
- 7

galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.

dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
16 changes: 16 additions & 0 deletions roles/partition-disk/tasks/extend_root_partition.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- name: "Extend root partition LV to all available VG space"
when: item.key in "lv_root"
lvol:
vg: "{{ item.value.vg }}"
lv: "{{ item.key }}"
size: +100%FREE
with_dict: "{{ ansible_lvm.lvs }}"

- name: "Resize the root filesystem"
when: item.key in "lv_root"
filesystem:
dev: "/dev/{{ item.value.vg }}/{{ item.key }}"
fstype: xfs
resizefs: yes
with_dict: "{{ ansible_lvm.lvs }}"
...
4 changes: 4 additions & 0 deletions roles/partition-disk/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
# tasks file for partition-disk
- include_tasks: remove_home_partition.yaml
- include_tasks: extend_root_partition.yaml
18 changes: 18 additions & 0 deletions roles/partition-disk/tasks/remove_home_partition.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
- name: "Unmount /home partition"
mount:
name: /home
state: unmounted
- name: "Remove /home entry from /etc/fstab"
mount:
name: /home
state: absent
- name: "Remove /home Logical Volume"
when: item.key in "lv_home"
lvol:
vg: "{{ item.value.vg }}"
lv: "{{ item.key }}"
state: absent
force: yes
with_dict: "{{ ansible_lvm.lvs }}"
...
2 changes: 2 additions & 0 deletions roles/partition-disk/tests/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[sat63]
sat63-rhel7 ansible_ssh_host=sat63-rhel7.example.com ansible_user=root
4 changes: 4 additions & 0 deletions roles/partition-disk/tests/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
- hosts: sat63
roles:
- partition-disk
2 changes: 2 additions & 0 deletions roles/partition-disk/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# vars file for partition-disk

0 comments on commit 4f86d26

Please sign in to comment.