B.3. Red Hat Network Configuration Manager
Ao contrário do Red Hat Network Configuration Client, o Red Hat Network Configuration Manager (
rhncfg-manager
) é desenvolvido para manter o repositório central de arquivos e canais de configuração do RHN, e não aqueles localizados nos sistemas cliente. Esta ferramenta oferece uma alternativa de linha de comando às funcionalidades de administração de configuração do site do RHN, assim como a habilidade de elaborar scripts para partes ou para toda a manutenção relacionada.
Seu uso é direcionado aos Administradores de Configuração e requer um nome de usuário e senha do RHN que tenham as permissões apropriadas definidas. O nome de usuário pode ser especificado em
/etc/sysconfig/rhn/rhncfg-manager.conf
ou na seção [rhncfg-manager] de ~/.rhncfgrc
.
Quando o Red Hat Network Configuration Manager é executado como root, tenta trazer valores de configuração necessários do Red Hat Update Agent. Quando executado com qualquer outro usuário além de root, talvez seja preciso efetuar alterações de configuração no arquivo
~/.rhncfgrc
. O arquivo da sessão é guardado no cache de ~/.rhncfg-manager-session
a fim de evitar a autenticação para cada comando.
O tempo limite default do Red Hat Network Configuration Manager é 30 minutos. Para alterar este valor, adicione a opção
server.session_lifetime
e o novo valor ao arquivo /etc/rhn/rhn.conf
no servidor rodando o administrador, como:
server.session_lifetime = 120
server.session_lifetime = 120
O Red Hat Network Configuration Manager oferece estes modos principais: adicionar (add), criar canal (create-channel), diferenciação (diff), diferenciação entre revisões (diff-revisions), download de canal (download-channel), obter (get), listar (list), listar canais (list-channels), remover (remove), remover canal (remove-channel), revisões (revisions), atualizar (update) e fazer upload de canal (upload-channel).
Cada modo oferece seu próprio conjunto de permissões, que pode ser visto ao executar o comando seguinte:
rhncfg-manager mode --help
rhncfg-manager mode --help rhncfg-manager mode --help rhncfg-manager mode --help
Substitua mode pelo nome do modo a ser inspecionado:
rhncfg-manager diff-revisions --help
rhncfg-manager diff-revisions --help
Você pode ver esta lista de opções para o modo adicionar (add) na Tabela B.4, “opções do
rhncfg-manager add
”.
B.3.1. Criando um Canal de Configuração Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Para criar um canal de configuração para sua empresa, execute o comando:
rhncfg-manager create-channel channel-label
rhncfg-manager create-channel channel-label rhncfg-manager create-channel channel-label
Se for necessário, indique seu nome de usuário e senha do RHN. O resultado é semelhante a este:
Red Hat Network username: rhn-user Password: Creating config channel channel-label Config channel channel-label created
Red Hat Network username: rhn-user Password: Creating config channel channel-label Config channel channel-label created Red Hat Network username: rhn-user Password: Creating config channel channel-label Config channel channel-label created Red Hat Network username: rhn-user Password: Creating config channel channel-label Config channel channel-label created Red Hat Network username: rhn-user Password: Creating config channel channel-label Config channel channel-label created Red Hat Network username: rhn-user Password: Creating config channel channel-label Config channel channel-label created
Após criar o canal de configuração, use os modos remanescentes listados acima para popular e manter aquele canal.
B.3.2. Adicionando Arquivos a um Canal de Configuração Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Para adicionar um arquivo a um canal de configuração, especifique a etiqueta do canal, assim como o arquivo local para upload. Por exemplo:
rhncfg-manager add --channel=channel-label /path/to/file
rhncfg-manager add --channel=channel-label /path/to/file rhncfg-manager add --channel=channel-label /path/to/file rhncfg-manager add --channel=channel-label /path/to/file rhncfg-manager add --channel=channel-label /path/to/file
Além da etiqueta do canal e do caminho para o arquivo necessário, você deve usar as opções disponíveis para modificar o arquivo durante sua adição. Por exemplo, você pode alterar o caminho e o nome do arquivo, incluindo a opção
--dest-file
no comando. Por exemplo:
rhncfg-manager add --channel=channel-label--dest-file=/new/path/to/file.txt/path/to/file
rhncfg-manager add --channel=channel-label--dest-file=/new/path/to/file.txt/path/to/file rhncfg-manager add --channel=channel-label--dest-file=/new/path/to/file.txt/path/to/file rhncfg-manager add --channel=channel-label--dest-file=/new/path/to/file.txt/path/to/file rhncfg-manager add --channel=channel-label--dest-file=/new/path/to/file.txt/path/to/file
O resultado se parece com:
Pushing to channel example-channel Local file >/path/to/file -> remote file /new/path/to/file.txt
Pushing to channel example-channel Local file >/path/to/file -> remote file /new/path/to/file.txt
A tabela seguinte lista as opções do
rhncfg-manager add
:
Opção | Descrição |
---|---|
-cCHANNEL --channel=CHANNEL | Faz o upload de arquivos para este canal de configuração |
-dDEST_FILE --dest-file=DEST_FILE | Faz o upload do arquivo conforme este caminho |
--delim-start=DELIM_START | Inicia o delimitador para intercalar variáveis |
--delim-end=DELIM_END | Finaliza o delimitador para intercalar variáveis |
-h, --help | exibe a mensagem de ajuda e fecha |
Nota
Por padrão, o tamanho máximo de arquivo para arquivos de configuração é 128KB. Se você precisar modificar este valor, encontre ou crie a seguinte linha no arquivo
/etc/rhn/rhn.conf
:
web.maximum_config_file_size=128
web.maximum_config_file_size=128
Mude o valor de 128 para qualquer limite que você deseja em bytes.
B.3.3. Diferenciando entre os Arquivos de Configuração mais Recentes Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Para ver as diferenças entre os arquivos de configuração no disco e as revisões mais recentes de um canal, execute o comando:
rhncfg-manager diff --channel=channel-label --dest-file=/path/to/file.txt \ /local/path/to/file
rhncfg-manager diff --channel=channel-label --dest-file=/path/to/file.txt \ /local/path/to/file rhncfg-manager diff --channel=channel-label --dest-file=/path/to/file.txt \ /local/path/to/file rhncfg-manager diff --channel=channel-label --dest-file=/path/to/file.txt \ /local/path/to/file rhncfg-manager diff --channel=channel-label --dest-file=/path/to/file.txt \ /local/path/to/file rhncfg-manager diff --channel=channel-label --dest-file=/path/to/file.txt \ /local/path/to/file rhncfg-manager diff --channel=channel-label --dest-file=/path/to/file.txt \ /local/path/to/file
Você deve observar um resultado parecido com:
/tmp/dest_path/example-config.txt /home/test/blah/hello_world.txt --- /tmp/dest_path/example-config.txt config_channel: example-channel revision: 1 +++ /home/test/blah/hello_world.txt 2003-12-14 19:08:59.000000000 -0500 @@ -1 +1 @@ -foo +hello, world
/tmp/dest_path/example-config.txt /home/test/blah/hello_world.txt --- /tmp/dest_path/example-config.txt config_channel: example-channel revision: 1 +++ /home/test/blah/hello_world.txt 2003-12-14 19:08:59.000000000 -0500 @@ -1 +1 @@ -foo +hello, world
A tabela seguinte lista as opções do
rhncfg-manager diff
:
Opção | Descrição |
---|---|
-cCHANNEL, --channel=CHANNEL | Obtém arquivo(s) deste canal de configuração |
-rREVISION, --revision=REVISION | Usa esta revisão |
-dDEST_FILE, --dest-file=DEST_FILE | Faz o upload do arquivo conforme este caminho |
-tTOPDIR, --topdir=TOPDIR | Torna todos os arquivos relativos a este string |
-h, --help | Exibe a mensagem de ajuda e fecha |
B.3.4. Diferenciando entre Versões Diversas Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Para comparar versões diferentes de um arquivo dentre canais e revisões, use a opção
-r
para indicar qual revisão do arquivo deve ser comparada, e a opção -n
para identificar os dois canais a serem verificados. Consulte a Seção B.3.11, “Determinando o Número de Revisões do Arquivo” para instruções. Especifique somente o nome de um arquivo aqui, já que você está comparando o arquivo a uma outra versão do mesmo. Por exemplo:
rhncfg-manager diff-revisions -n=channel-label1-r=1-n=channel-label2-r=1/path/to/file.txt
rhncfg-manager diff-revisions -n=channel-label1-r=1-n=channel-label2-r=1/path/to/file.txt rhncfg-manager diff-revisions -n=channel-label1-r=1-n=channel-label2-r=1/path/to/file.txt rhncfg-manager diff-revisions -n=channel-label1-r=1-n=channel-label2-r=1/path/to/file.txt rhncfg-manager diff-revisions -n=channel-label1-r=1-n=channel-label2-r=1/path/to/file.txt rhncfg-manager diff-revisions -n=channel-label1-r=1-n=channel-label2-r=1/path/to/file.txt rhncfg-manager diff-revisions -n=channel-label1-r=1-n=channel-label2-r=1/path/to/file.txt
O resultado se parece com:
--- /tmp/dest_path/example-config.txt 2004-01-13 14:36:41 \ config channel: example-channel2 revision: 1 --- /tmp/dest_path/example-config.txt 2004-01-13 14:42:42 \ config channel: example-channel3 revision: 1 @@ -1 +1,20 @@ -foo +blaaaaaaaaaaaaaaah +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.0.6 (GNU/Linux) +Comment: For info see http://www.gnupg.org + +iD8DBQA9ZY6vse4XmfJPGwgRAsHcAJ9ud9dabUcdscdcqB8AZP7e0Fua0NmKsdhQCeOWHX +VsDTfen2NWdwwPaTM+S+Cow= +=Ltp2 +-----END PGP SIGNATURE-----
--- /tmp/dest_path/example-config.txt 2004-01-13 14:36:41 \ config channel: example-channel2 revision: 1 --- /tmp/dest_path/example-config.txt 2004-01-13 14:42:42 \ config channel: example-channel3 revision: 1 @@ -1 +1,20 @@ -foo +blaaaaaaaaaaaaaaah +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.0.6 (GNU/Linux) +Comment: For info see http://www.gnupg.org + +iD8DBQA9ZY6vse4XmfJPGwgRAsHcAJ9ud9dabUcdscdcqB8AZP7e0Fua0NmKsdhQCeOWHX +VsDTfen2NWdwwPaTM+S+Cow= +=Ltp2 +-----END PGP SIGNATURE-----
A tabela seguinte lista as opções do
rhncfg-manager diff-revisions
:
Opção | Descrição |
---|---|
-cCHANNEL, --channel=CHANNEL | Usa este canal de configuração |
-rREVISION, --revision=REVISION | Usa esta revisão |
-h, --help | Exibe a mensagem de ajuda e fecha |
B.3.5. Fazendo o Download de Todos Arquivos de um Canal Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Para fazer o download de todos os arquivos de um canal para o disco, crie um diretório e execute o seguinte comando:
rhncfg-manager download-channel channel-label --topdir .
rhncfg-manager download-channel channel-label --topdir . rhncfg-manager download-channel channel-label --topdir . rhncfg-manager download-channel channel-label --topdir .
O resultado se parece com:
Copying /tmp/dest_path/example-config.txt -> \ blah2/tmp/dest_path/example-config.txt
Copying /tmp/dest_path/example-config.txt -> \ blah2/tmp/dest_path/example-config.txt
A tabela seguinte lista as opções do
rhncfg-manager download-channel
:
Opção | Descrição |
---|---|
-tTOPDIR, --topdir=TOPDIR | O diretório ao qual todas os caminhos de arquivo são relativos. Esta opção deve ser definida. |
-h, --help | Exibe a mensagem de ajuda e fecha |
B.3.6. Obtendo o Conteúdo de um Arquivo Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Para direcionar o conteúdo de um arquivo específico para stdout, execute o comando:
rhncfg-manager get --channel=channel-label \ /tmp/dest_path/example-config.txt
rhncfg-manager get --channel=channel-label \ /tmp/dest_path/example-config.txt rhncfg-manager get --channel=channel-label \ /tmp/dest_path/example-config.txt rhncfg-manager get --channel=channel-label \ /tmp/dest_path/example-config.txt
Você deve observar o conteúdo do arquivo como resultado.
B.3.7. Listando Todos Arquivos de um Canal Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Para listar todos os arquivos de um canal, execute o comando:
rhncfg-manager list channel-label
rhncfg-manager list channel-label rhncfg-manager list channel-label
Você deve observar um resultado parecido com:
Files in config channel `example-channel3': /tmp/dest_path/example-config.txt
Files in config channel `example-channel3': /tmp/dest_path/example-config.txt
A tabela seguinte lista as opções do
rhncfg-manager get
:
Opção | Descrição |
---|---|
-cCHANNEL, --channel=CHANNEL | Obtém arquivo(s) deste canal de configuração |
-tTOPDIR, --topdir=TOPDIR | Torna todos os arquivos relativos a este string |
-rREVISION, --revision=REVISION | Obter esta revisão do arquivo |
-h, --help | Exibe a mensagem de ajuda e fecha |
B.3.8. Listando Todos Canais de Configuração Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Para listar todos os canais de configuração da sua empresa, execute o comando:
rhncfg-manager list-channels
rhncfg-manager list-channels
O resultado se parece com:
Available config channels: example-channel example-channel2 example-channel3 config-channel-14 config-channel-17
Available config channels: example-channel example-channel2 example-channel3 config-channel-14 config-channel-17
Note que este comando não lista os canais
local_override
ou server_import
.
B.3.9. Removendo um Arquivo de um Canal Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Para remover um arquivo de um canal, execute o comando:
rhncfg-manager remove --channel=channel-label /tmp/dest_path/example-config.txt
rhncfg-manager remove --channel=channel-label /tmp/dest_path/example-config.txt rhncfg-manager remove --channel=channel-label /tmp/dest_path/example-config.txt rhncfg-manager remove --channel=channel-label /tmp/dest_path/example-config.txt rhncfg-manager remove --channel=channel-label /tmp/dest_path/example-config.txt
Se for necessário, indique seu nome de usuário e senha do RHN. Você deve observar um resultado semelhante a:
Red Hat Network username: rhn-user Password: Removing from config channel example-channel3 /tmp/dest_path/example-config.txt removed
Red Hat Network username: rhn-user Password: Removing from config channel example-channel3 /tmp/dest_path/example-config.txt removed
A tabela seguinte lista as opções do
rhncfg-manager remove
:
Opção | Descrição |
---|---|
-cCHANNEL, --channel=CHANNEL | Remove arquivos deste canal de configuração |
-tTOPDIR, --topdir=TOPDIR | Torna todos os arquivos relativos a este string |
-h, --help | Exibe a mensagem de ajuda e fecha |
B.3.10. Apagando um Arquivo de Configuração Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Para eliminar um canal de configuração de sua empresa, execute o comando:
rhncfg-manager remove-channel channel-label
rhncfg-manager remove-channel channel-label rhncfg-manager remove-channel channel-label rhncfg-manager remove-channel channel-label
O resultado se parece com:
Removing config channel example-channel Config channel example-channel removed
Removing config channel example-channel Config channel example-channel removed
B.3.11. Determinando o Número de Revisões do Arquivo Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Para descobrir quantas revisões (as revisões vão de 1 a N, sendo N um número inteiro maior que 0) de um arquivo/caminho existem num canal, execute o seguinte comando:
rhncfg-manager revisions channel-label /tmp/dest_path/example-config.txt
rhncfg-manager revisions channel-label /tmp/dest_path/example-config.txt rhncfg-manager revisions channel-label /tmp/dest_path/example-config.txt rhncfg-manager revisions channel-label /tmp/dest_path/example-config.txt
O resultado se parece com:
Analyzing files in config channel example-channel \ /tmp/dest_path/example-config.txt: 1
Analyzing files in config channel example-channel \ /tmp/dest_path/example-config.txt: 1
B.3.12. Atualizando um Arquivo de um Canal Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Para criar uma nova revisão de um arquivo num canal (ou adicionar a primeira revisão neste canal, caso nenhuma exista antes para o caminho provido), execute o seguinte comando:
rhncfg-manager update \ --channel=channel-label --dest-file=/path/to/file.txt /local/path/to/file
rhncfg-manager update \ --channel=channel-label --dest-file=/path/to/file.txt /local/path/to/file rhncfg-manager update \ --channel=channel-label --dest-file=/path/to/file.txt /local/path/to/file rhncfg-manager update \ --channel=channel-label --dest-file=/path/to/file.txt /local/path/to/file rhncfg-manager update \ --channel=channel-label --dest-file=/path/to/file.txt /local/path/to/file rhncfg-manager update \ --channel=channel-label --dest-file=/path/to/file.txt /local/path/to/file rhncfg-manager update \ --channel=channel-label --dest-file=/path/to/file.txt /local/path/to/file
O resultado se parece com:
Pushing to channel example-channel: Local file example-channel/tmp/dest_path/example-config.txt -> \ remote file /tmp/dest_path/example-config.txt
Pushing to channel example-channel: Local file example-channel/tmp/dest_path/example-config.txt -> \ remote file /tmp/dest_path/example-config.txt
A tabela seguinte lista as opções do
rhncfg-manager update
:
Opção | Descrição |
---|---|
-cCHANNEL, --channel=CHANNEL | Faz o upload de arquivos para este canal de configuração |
-dDEST_FILE, --dest-file=DEST_FILE | Faz o upload do arquivo conforme este caminho |
-tTOPDIR, --topdir=TOPDIR | Torna todos os arquivos relativos a este string |
--delim-start=DELIM_START | Inicia o delimitador para intercalar variáveis |
--delim-end=DELIM_END | Finaliza o delimitador para intercalar variáveis |
-h, --help | Exibe a mensagem de ajuda e fecha |
B.3.13. Upload de Arquivos Múltiplos Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
Para fazer o upload de arquivos múltiplos do disco local para um canal de configuração de uma vez, execute o comando:
rhncfg-manager upload-channel --topdir=topdir channel-label
rhncfg-manager upload-channel --topdir=topdir channel-label rhncfg-manager upload-channel --topdir=topdir channel-label rhncfg-manager upload-channel --topdir=topdir channel-label rhncfg-manager upload-channel --topdir=topdir channel-label
O resultado se parece com:
Using config channel example-channel4 Uploading /tmp/ola_world.txt from blah4/tmp/ola_world.txt
Using config channel example-channel4 Uploading /tmp/ola_world.txt from blah4/tmp/ola_world.txt
A tabela seguinte lista as opções do
rhncfg-manager upload-channel
:
Opção | Descrição |
---|---|
-tTOPDIR, --topdir=TOPDIR | O diretório ao qual todas os caminhos de arquivo são relativos |
-cCHANNEL, --channel=CHANNEL | Lista dos canais aos quais as informações de configuração serão salvas (uploaded). Os canais são delimitados por ','. Exemplo: --channel=foo,bar,baz |
-h, --help | Exibe a mensagem de ajuda e fecha |