create cloud commander roles
This commit is contained in:
commit
800e47c63e
38
README.md
Normal file
38
README.md
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
Role Name
|
||||||
|
=========
|
||||||
|
|
||||||
|
A brief description of the role goes here.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||||
|
|
||||||
|
- hosts: servers
|
||||||
|
roles:
|
||||||
|
- { role: username.rolename, x: 42 }
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
BSD
|
||||||
|
|
||||||
|
Author Information
|
||||||
|
------------------
|
||||||
|
|
||||||
|
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
8
defaults/main.yml
Normal file
8
defaults/main.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
cloud_commander_volume:
|
||||||
|
- "{{cloud_commander_config_path}}:/root"
|
||||||
|
- "/mnt/diskstation:{{cloud_commander_root}}:shared"
|
||||||
|
cloud_commander_port: "8000:8000"
|
||||||
|
cloud_commander_config_path: "/etc/cloudcommander"
|
||||||
|
cloud_commander_option: "--no-config-dialog --no-terminal "
|
||||||
|
cloud_commander_root: "/mnt"
|
||||||
|
|
2
handlers/main.yml
Normal file
2
handlers/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# handlers file for cloud-commander
|
6
meta/main.yml
Normal file
6
meta/main.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
dependencies:
|
||||||
|
- {role: docker, become: yes }
|
||||||
|
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||||
|
# if you add dependencies to this list.
|
||||||
|
|
29
tasks/main.yml
Normal file
29
tasks/main.yml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
- name: create config directory
|
||||||
|
file:
|
||||||
|
path: "{{cloud_commander_config_path}}"
|
||||||
|
state: directory
|
||||||
|
mode: 0700
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
- name: copy config
|
||||||
|
template:
|
||||||
|
dest: "{{cloud_commander_config_path}}/.cloudcmd.json" # required. Location to render the template to on the remote machine.
|
||||||
|
src: config.j2 # required. Path of a Jinja2 formatted template on the Ansible controller. This can be a relative or absolute path.
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
- name: creation du container docker
|
||||||
|
docker_container:
|
||||||
|
name: "cloudcommander" # required. Assign a name to a new container or match an existing container.,When identifying an existing container name may be a name or a long or short container ID.
|
||||||
|
tty: yes # not required. Allocate a pseudo-TTY.
|
||||||
|
image: coderaiser/cloudcmd # not required. Repository path and tag used to create the container. If an image is not found or pull is true, the image will be pulled from the registry. If no tag is included, 'latest' will be used.
|
||||||
|
working_dir: /root # not required. Path to the working directory.
|
||||||
|
published_ports: "{{cloud_commander_port}}" # not required. List of ports to publish from the container to the host.,Use docker CLI syntax: C(8000), C(9000:8000), or C(0.0.0.0:9000:8000), where 8000 is a container port, 9000 is a host port, and 0.0.0.0 is a host interface.,Container ports must be exposed either in the Dockerfile or via the C(expose) option.,A value of all will publish all exposed container ports to random host ports, ignoring any other mappings.,If C(networks) parameter is provided, will inspect each network to see if there exists a bridge network with optional parameter com.docker.network.bridge.host_binding_ipv4. If such a network is found, then published ports where no host IP address is specified will be bound to the host IP pointed to by com.docker.network.bridge.host_binding_ipv4. Note that the first bridge network with a com.docker.network.bridge.host_binding_ipv4 value encountered in the list of C(networks) is the one that will be used.
|
||||||
|
pull: yes # not required. If true, always pull the latest version of an image. Otherwise, will only pull an image when missing.
|
||||||
|
state: started # not required. choices: absent;present;stopped;started. I(absent) - A container matching the specified name will be stopped and removed. Use force_kill to kill the container rather than stopping it. Use keep_volumes to retain volumes associated with the removed container.,I(present) - Asserts the existence of a container matching the name and any provided configuration parameters. If no container matches the name, a container will be created. If a container matches the name but the provided configuration does not match, the container will be updated, if it can be. If it cannot be updated, it will be removed and re-created with the requested config. Image version will be taken into account when comparing configuration. To ignore image version use the ignore_image option. Use the recreate option to force the re-creation of the matching container. Use force_kill to kill the container rather than stopping it. Use keep_volumes to retain volumes associated with a removed container.,I(started) - Asserts there is a running container matching the name and any provided configuration. If no container matches the name, a container will be created and started. If a container matching the name is found but the configuration does not match, the container will be updated, if it can be. If it cannot be updated, it will be removed and a new container will be created with the requested configuration and started. Image version will be taken into account when comparing configuration. To ignore image version use the ignore_image option. Use recreate to always re-create a matching container, even if it is running. Use restart to force a matching container to be stopped and restarted. Use force_kill to kill a container rather than stopping it. Use keep_volumes to retain volumes associated with a removed container.,I(stopped) - Asserts that the container is first I(present), and then if the container is running moves it to a stopped state. Use force_kill to kill a container rather than stopping it.
|
||||||
|
keep_volumes: yes # not required. Retain volumes associated with a removed container.
|
||||||
|
restart_policy: "on-failure" # not required. choices: no;on-failure;always;unless-stopped. Container restart policy. Place quotes around I(no) option.
|
||||||
|
command: "{{cloud_commander_option}}" # not required. Command to execute when the container starts. A command may be either a string or a list. Prior to version 2.4, strings were split on commas.
|
||||||
|
volumes: "{{cloud_commander_volume}}" # not required. List of volumes to mount within the container.,Use docker CLI-style syntax: C(/host:/container[:mode]),You can specify a read mode for the mount with either C(ro) or C(rw).,SELinux hosts can additionally use C(z) or C(Z) to use a shared or private label for the volume.
|
||||||
|
become: yes
|
||||||
|
|
48
templates/config.j2
Normal file
48
templates/config.j2
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
"name": "",
|
||||||
|
"auth": true,
|
||||||
|
"username": "{{user.name}}",
|
||||||
|
"password": "{{vault_cloudcommander_password_hash}}",
|
||||||
|
"algo": "sha512WithRSAEncryption",
|
||||||
|
"editor": "edward",
|
||||||
|
"packer": "tar",
|
||||||
|
"diff": true,
|
||||||
|
"zip": true,
|
||||||
|
"buffer": true,
|
||||||
|
"dirStorage": false,
|
||||||
|
"online": true,
|
||||||
|
"open": false,
|
||||||
|
"keysPanel": true,
|
||||||
|
"port": 8000,
|
||||||
|
"ip": null,
|
||||||
|
"root": "{{cloud_commander_root}}",
|
||||||
|
"prefix": "",
|
||||||
|
"prefixSocket": "",
|
||||||
|
"contact": true,
|
||||||
|
"confirmCopy": true,
|
||||||
|
"confirmMove": true,
|
||||||
|
"configDialog": true,
|
||||||
|
"configAuth": true,
|
||||||
|
"oneFilePanel": true,
|
||||||
|
"console": false,
|
||||||
|
"syncConsolePath": false,
|
||||||
|
"terminal": false,
|
||||||
|
"terminalPath": "gritty",
|
||||||
|
"terminalCommand": "",
|
||||||
|
"terminalAutoRestart": true,
|
||||||
|
"showConfig": false,
|
||||||
|
"showFileName": true,
|
||||||
|
"vim": false,
|
||||||
|
"columns": "name-size-date-owner-mode",
|
||||||
|
"export": false,
|
||||||
|
"exportToken": "root",
|
||||||
|
"import": false,
|
||||||
|
"importToken": "root",
|
||||||
|
"importUrl": "https://file.{{domain.name}}",
|
||||||
|
"importListen": false,
|
||||||
|
"log": true,
|
||||||
|
"dropbox": false,
|
||||||
|
"dropboxToken": ""
|
||||||
|
}
|
||||||
|
|
2
tests/inventory
Normal file
2
tests/inventory
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
5
tests/test.yml
Normal file
5
tests/test.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- cloud-commander
|
2
vars/main.yml
Normal file
2
vars/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# vars file for cloud-commander
|
Loading…
Reference in New Issue
Block a user