Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 8x 1x 7x 1x 6x 2x 2x 2x 2x 2x 2x 2x 2x 4x 4x 4x 4x 2x 2x 2x 2x 2x 2x 2x 2x 1x | "use strict";
const ansibleConfig = `\
[defaults]
host_key_checking = False
gathering = smart
fact_caching = jsonfile
fact_caching_connection = /etc/ansible/facts
fact_caching_timeout = 3600
callback_whitelist = profile_tasks
timeout = 120
[ssh_connection]
control_path_dir = /tmp/
ssh_args = -oControlMaster=auto -oControlPersist=60m -oPreferredAuthentications=hostbased
`;
const staticPlaybooks = {};
staticPlaybooks.wait_for_bootup = `\
- hosts: all
gather_facts: no
tasks:
- name: wait for all nodes to become reachable via ssh
wait_for_connection:
timeout: 600
`;
staticPlaybooks.setupHostbasedAuth = `\
- hosts: localhost
become: yes
vars:
ssh_hostbased_auth_permit_root_login: yes
roles:
- so5.ssh_hostbased_auth
`;
staticPlaybooks.nfs = `\
- hosts: head
become: yes
vars:
nfs_exports: ["/home {{ ansible_default_ipv4['network'] }}/{{ ansible_default_ipv4['netmask'] }}(rw,no_root_squash,fsid=0,no_subtree_check)"]
roles:
- { "role": "geerlingguy.nfs" }
- hosts: child
become: yes
tasks:
- include_role:
name: andrewrothstein.nfs-client
- shell: "hostname -i"
register: nfs_server
delegate_to: localhost
- mount:
path: "/home"
state: "mounted"
fstype: "nfs"
src: "{{ nfs_server.stdout }}:/"
opts: "proto=tcp,rw,soft"
`;
staticPlaybooks.installPBSPro = `\
- hosts: localhost
become: yes
vars:
pbspro_prefix: "/usr/local"
pbspro_installtaion: true
pbspro_setup: false
roles:
- "so5.pbspro"
`;
function getPbsproPlaybook(opt) {
const head = `\
- hosts: all
become: yes
`;
let vars = `\
vars:
pbspro_prefix: "/usr/local"
pbspro_installtaion: false
pbspro_setup: true
pbspro_server_hostname: "{{ groups['head'][0] }}"
pbspro_child_nodes: "{{ groups['child'] }}"\n`;
//be careful about indent!!
//pbspro_child_nodes and pbspro_qmgr_cmds must be in the same indent level
Eif (opt.hasOwnProperty("qmgrCmds") && Array.isArray(opt.qmgrCmds)) {
vars += ` pbspro_qmgr_cmds: [ ${opt.qmgrCmds.map((e)=>{
return `"${e}"`;
}).join(",")} ]\n`;
}
Eif (opt.hasOwnProperty("runJobOnBatchServer")) {
vars += ` pbspro_run_job_on_server: ${opt.runJobOnBatchServer}\n`;
}
const tail = `\
roles:
- { "role": "so5.pbspro", "pbspro_server": "{{ 'head' in group_names }}" }\n`;
return `\
${head}
${vars}
${tail}
`;
}
/**
* Return playbook.
* @param {string} name - Name of playbook.
* @param {string} opt - Common option argument extracted from order object.
* @returns {string} - Contens of playbook.
*/
function getPlaybook(name, opt) {
if (name === "pbspro") {
return getPbsproPlaybook(opt);
}
if (name === "userPlaybook") {
return opt.playbook;
}
return staticPlaybooks[name]; //this statement is fall back, so if name is invaid, this function returns undefined
}
/**
* Return playbook names.
* @param {string} opt - Common option argument extracted from order object.
* @returns {string[]} - Playbook names to be used.
*/
function getPlaybookNames(opt) {
const playbooks = ["wait_for_bootup"];
Eif (opt.shareStorage) {
playbooks.push("nfs");
}
Eif (opt.batch) {
playbooks.push(opt.batch);
}
Eif (opt.playbook) {
playbooks.push("userPlaybook");
}
return playbooks;
}
/**
* Return array of playbooks name which should be run locally on each node.
* @param {string} opt - Common option argument extracted from order object.
* @returns {string[]} - Playbook names to be used.
*/
function getLocalPlaybookNames(opt) {
const playbooks = ["setupHostbasedAuth"];
Eif (opt.batch === "pbspro") {
playbooks.push("installPBSPro");
}
return playbooks;
}
/**
* Return role names which should be downloaded from ansible-galaxy.
* @param {string} opt - Common option argument extracted from order object.
* @returns {string[]} - Playbook names to be used.
*/
function getRoleNames(opt) {
const shareStorage = opt.shareStorage;
const batch = opt.batch;
const roleNames = ["so5.ssh_hostbased_auth"];
Eif (shareStorage) {
roleNames.push("geerlingguy.nfs", "andrewrothstein.nfs-client");
}
Eif (batch === "pbspro") {
roleNames.push("so5.pbspro");
}
return roleNames;
}
module.exports = {
ansibleConfig,
getPlaybook,
getPlaybookNames,
getLocalPlaybookNames,
getRoleNames
};
|